Re: [SQL] Need help with plpgsql function.

2010-11-13 Thread Pavel Stehule
2010/11/14 berelith : > > Hi, > > I'm creating the function on a postgres 8.2 server. > I would like the function to accept half a dozen varied parameters (varchars > and timestamps). > The first parameter will determine which one of the 6 different select > queries that function is going to run. >

[SQL] Need help with plpgsql function.

2010-11-13 Thread berelith
Hi, I'm creating the function on a postgres 8.2 server. I would like the function to accept half a dozen varied parameters (varchars and timestamps). The first parameter will determine which one of the 6 different select queries that function is going to run. The function will return all the row

Re: [SQL] psql -f COPY from STDIN

2010-11-13 Thread Tarlika Elisabeth Schmitz
On Sat, 13 Nov 2010 12:01:35 + Tarlika Elisabeth Schmitz wrote: >I'd like the store the COPY command in a separate file without >specifying an input file name. I want to feed it the data from the >shell script that calls psql "STDIN: All rows are read from the same source that issued the co

Re: [SQL] psql -f COPY from STDIN

2010-11-13 Thread Tom Lane
Tarlika Elisabeth Schmitz writes: > I changed event.sql (3 lines): > \COPY > (event_id, event_name) > FROM STDIN DELIMITER AS ',' NULL AS '' > Now I am getting error messages: > psql:event.sql:1: \copy:parse error at end of line I don't believe you can split backslash commands across lin

Re: [SQL] psql -f COPY from STDIN

2010-11-13 Thread Tarlika Elisabeth Schmitz
On Fri, 12 Nov 2010 22:22:11 -0500 Tom Lane wrote: >Tarlika Elisabeth Schmitz writes: >> The following command works fine when pasing it to psql via the -c >> option: > >> cat event.csv | \ >> psql -c "COPY (event_id, event_name) FROM STDIN DELIMITER AS ',' NULL >> AS ''" > >> When executed from