Re: loading a funtion script from a file
От | Scott Marlowe |
---|---|
Тема | Re: loading a funtion script from a file |
Дата | |
Msg-id | dcc563d10711211129j5660a6e9t80bb5f9030e2395b@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: loading a funtion script from a file (Richard Huxton <dev@archonet.com>) |
Список | pgsql-general |
On Nov 21, 2007 1:07 PM, Richard Huxton <dev@archonet.com> wrote: > Scott Marlowe wrote: > > On Nov 21, 2007 12:21 PM, David Fetter <david@fetter.org> wrote: > >> On Wed, Nov 21, 2007 at 11:10:15AM -0600, Scott Marlowe wrote: > >>> On Nov 21, 2007 10:49 AM, Richard Huxton <dev@archonet.com> wrote: > >>>> Gauthier, Dave wrote: > >>>>> APparently, from "man psql", -c can do only one thing at a time. But you could do this with 2-3 commands (or 1 ifyou want to wrap the 2 up in a shell script or something). Here's an example... > >>>> [snip] > >>>>> psql --dbname mydb -c "\i create_try.sql;" > >>>>> psql --dbname mydb -c "select trythis('foo');" > >>>>> psql --dbname mydb -c "drop function trythis(varchar);" > >>>> 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 > >> Should anything go wrong with either of these constructs, you don't > >> get the line number where it did, so the following is better: > > > > Umm, as I posted before, I DO get the line number. the output I get > > looks exactly the same as if I use -f. > > Richard posted an example of when he did get the same thing, but not > > one of where he didn't. > > (checks again). No, they're different: SNIP > The -f gives me line 12, from STDIN it doesn't. Ahhh, now I see. I assume that stdin acts the same as if you'd run psql and typed the commands in one at a time, hence the LINE1: at the beginning of that line.
В списке pgsql-general по дате отправления: