Re: loading a funtion script from a file
От | Richard Huxton |
---|---|
Тема | Re: loading a funtion script from a file |
Дата | |
Msg-id | 47447007.6000908@archonet.com обсуждение исходный текст |
Ответ на | Re: loading a funtion script from a file ("Scott Marlowe" <scott.marlowe@gmail.com>) |
Список | pgsql-general |
Scott Marlowe wrote: > On Nov 21, 2007 11:16 AM, Richard Huxton <dev@archonet.com> wrote: >> Scott Marlowe wrote: >>> On Nov 21, 2007 10:49 AM, Richard Huxton <dev@archonet.com> wrote: >>>> Or just put everything in one file and use -f <filename> >>> And from the more than one way to skin a cat department: >>> >>> cat my.sql | psql mydb >>> psql mydb < my.sql >> Bearing in mind that although both mine and Scott's cats are skinless, >> mine gave me line numbers in error messages. > > So do both of mine... In fact, trying all four ways (\i, cat | psql, > psql < file.sql, and psql -f file) gave me the same error output. Hmm - never used to... (checks) Can't get the same here (v8.2) apart from the COPY errors. === begin test1.sql === BEGIN; CREATE TABLE test1 (a int, b text, PRIMARY KEY (a)) ; COPY test1 FROM STDIN; 1 AAA 2 BBB 3 CCC 1 AAA \. SELCT true; ROLLBACK; === end test1.sql === $ psql82 -U richardh -f test1.sql BEGIN psql:test1.sql:3: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test1_pkey" for table "test1" CREATE TABLE psql:test1.sql:10: ERROR: duplicate key violates unique constraint "test1_pkey" CONTEXT: COPY test1, line 4: "1 AAA" psql:test1.sql:12: ERROR: syntax error at or near "SELCT" LINE 1: SELCT true; ^ ROLLBACK $ cat test1.sql | psql82 -U richardh BEGIN NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test1_pkey" for table "test1" CREATE TABLE ERROR: duplicate key violates unique constraint "test1_pkey" CONTEXT: COPY test1, line 4: "1 AAA" ERROR: syntax error at or near "SELCT" LINE 1: SELCT true; ^ ROLLBACK -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления: