Re: dynamically generate path to output file

2022-03-26 Thread Osvaldo Kussama
2022-03-26 6:35 GMT-03:00, rob...@redo2oo.ch :
> Hi Friends
>
> I would like to generate the path of a CSV file to which I output a query.
>
> This is what I try:
>
> CREATEORREPLACEPROCEDUREexport_cvs(
> home_dir varchar
> )
> AS
> $BODY$
> DECLARE
> OUTFILE varchar;
> BEGIN
> OUTFILE = (home_dir || '/tmp/company.csv');
> copy(
> select'company_'||id as"External ID",
> nameas"Name",'True'as"Is a Company",
> email,
> phone ,
> company_registry
> fromres_company
> ) TOOUTFILE withCSV HEADER;
> END;
> $BODY$
> LANGUAGEplpgsql;
>
> this produces a syntax error:
>
> psql:export_contacts_short.sql:21: ERROR:  syntax error at or near
> "OUTFILE"
> LINE 17: ) TO OUTFILE  with CSV HEADER;
>
>
> It works fine when I replace "TO OUTFILE" with a hard coded string.
>
> Can anybody of you give me a hint how to do that?
>
> Thanks a lot.
>
> Robert
>
>

Look at EXECUTE statement:
43.5.4. Executing Dynamic Commands
https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Osvaldo




Re: Question about when PostgreSQL 11.0 was released

2021-03-08 Thread Osvaldo Kussama
https://www.postgresql.org/docs/release/

2021-03-08 15:33 GMT-03:00, Michael Lewis :
> I can't find a page on the website right now that specifies it, but the
> feature freeze is around April each year then general availability in
> October. Minor releases are scheduled quarterly I believe. Major versions
> are EOL'd after 5 or so years.
>




Re: function difference not found

2021-11-25 Thread Osvaldo Kussama
2021-11-25 13:12 GMT-03:00, Shaozhong SHI :
> Function difference not found.
>
> Should an extension created for finding it?
>

Perhaps you are talking about EXCEPT set operator?
https://www.postgresql.org/docs/current/queries-union.html




Re: psql command failing with error "undefined symbol: PQhostaddr"

2021-12-28 Thread Osvaldo Kussama
2021-12-28 9:29 GMT-03:00, Narendra katlamudi :
> Hi Team
> When I use psql to connect a pg server, I am getting below error. Any
> solution/pointers?
> I have pg versions 11,12,13 installed on my system.
>
> /usr/lib/postgresql/13/bin/psql: symbol lookup error:
> /usr/lib/postgresql/13/bin/psql: undefined symbol: PQhostaddr
>
> thanks,Narendra K


Perhaps a typo?
PQHOSTADDR or PGHOSTADDR?