Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 如何在pgadmn上上载脚本?_Postgresql_Pgadmin_Postgresql Copy - Fatal编程技术网

Postgresql 如何在pgadmn上上载脚本?

Postgresql 如何在pgadmn上上载脚本?,postgresql,pgadmin,postgresql-copy,Postgresql,Pgadmin,Postgresql Copy,我无法在PGADMN上上载脚本。请帮我解决这个错误 SET statement_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; SET search_path = public, pg_catalog; SET default_tablesp

我无法在PGADMN上上载脚本。请帮我解决这个错误

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

SET default_tablespace = '  ';

SET default_with_oids = false;
ALTER TABLE public.pricemessage_archive OWNER TO postgres;
COPY pricemessage_archive (event_id, event_date, description, device_id, toll_zone, price) FROM stdin;
103462022 2017-03-15 22:41:02-05 Price VERIFIED V35ES02A Z35ES02 0.00
103462023   2017-03-15 22:41:02-05  Price VERIFIED  V35EN13 Z35EN01 0.00

更典型的方法是使用语句。INSERT也可能更好,因为SQL标准中没有语句

使用单个插入件

INSERT INTO pricemessage_archive
      (event_id, event_date, description, device_id, toll_zone, price)
VALUES(103462022, '2017-03-15 22:41:02-05', 'Price VERIFIED', 'V35ES02A', 'Z35ES02',
       0.00);

INSERT INTO pricemessage_archive
      (event_id, event_date, description, device_id, toll_zone, price)
VALUES(103462023, '2017-03-15 22:41:02-05', 'Price VERIFIED', 'V35EN13', 'Z35EN01',
       0.00);
使用多行值语法

INSERT INTO pricemessage_archive
      (event_id, event_date, description, device_id, toll_zone, price)
VALUES(103462022, '2017-03-15 22:41:02-05', 'Price VERIFIED', 'V35ES02A', 'Z35ES02',
       0.00)
      (103462023, '2017-03-15 22:41:02-05', 'Price VERIFIED', 'V35EN13', 'Z35EN01',
       0.00);

你没有说错误是什么,所以如果可以的话,你应该加上。我以前从来没有试过从stdin复制过。您可能希望转换为INSERT语句。如果我没有误解您的回答,pgAdmin不支持从stdin复制。我有一个来源的数据,它有相同的格式。它有3000万行,无法添加分隔符。还有别的办法吗?103462022 2017-03-15 22:41:02-05价格验证V35ES02A Z35ES02 0.00 103462023 2017-03-15 22:41:02-05价格验证V35EN13 Z35EN01 0.00相同格式,适用于3000万行@a_horse_____,没有名字,您无法从pgadmin中的stdin复制。查看该答案,了解执行导入的更多想法。我不认为pgAdmin是处理3000万条记录的合适工具。