Re: [SQL] Help with COPY command

2004-04-14 Thread Christoph Haller
> 
> Ok. I found the libpq syntax for COPY in the Programmer's manual. I've
> got a working version, but wanted to verify something.
> 
> PQexec(conn, "COPY foo FROM STDIN");
> PQputline(conn, "3\thello world\t4.5\n");
> PQputline(conn,"4\tgoodbye world\t7.11\n");
> ...
> PQputline(conn,"\\.\n");
> PQendcopy(conn);
> 
> 1. I'm assuming that I can put in as many PQputline statements as I
> want to between the PQexec("COPY ... FROM ...") and the terminator
> line. Is that correct? No limit?
> 
> 2. Do any of these lines need to be followed by a PQclear(res)? What
> about the first PQexec?
> 
> -Tony
> 
ad 1. Yes, no limit. 
ad 2. I use PQclear following the PQexec. 

Regards, Christoph 


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] Help with COPY command

2004-04-14 Thread Tony and Bryn Reina
Thanks for the reply. 

-Tony

- Original Message - 
From: "Christoph Haller" <[EMAIL PROTECTED]>
To: "Tony Reina" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, April 14, 2004 5:42 PM
Subject: Re: [SQL] Help with COPY command


> > 
> > Ok. I found the libpq syntax for COPY in the Programmer's manual. I've
> > got a working version, but wanted to verify something.
> > 
> > PQexec(conn, "COPY foo FROM STDIN");
> > PQputline(conn, "3\thello world\t4.5\n");
> > PQputline(conn,"4\tgoodbye world\t7.11\n");
> > ...
> > PQputline(conn,"\\.\n");
> > PQendcopy(conn);
> > 
> > 1. I'm assuming that I can put in as many PQputline statements as I
> > want to between the PQexec("COPY ... FROM ...") and the terminator
> > line. Is that correct? No limit?
> > 
> > 2. Do any of these lines need to be followed by a PQclear(res)? What
> > about the first PQexec?
> > 
> > -Tony
> > 
> ad 1. Yes, no limit. 
> ad 2. I use PQclear following the PQexec. 
> 
> Regards, Christoph 
> 
> 

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [SQL] full join...using and version of pgsql

2004-04-14 Thread scott.marlowe
On Wed, 14 Apr 2004, Tina Messmann wrote:

> hello list,
> 
> i am using pgsql 7.2.1
> i need something like
> 
> select * from t1 full join t2 using(bla) full join t3 using(bla)
> 
> i searched the archives and found that this is not possible with my 
> version of postgres.
> is this implemented in newer versions of postgres? since which version?
> 
> i'll try the alternative select * from t1 full join t2 on(t1.bla=t2.bla) 
> full join t3 on(t1/t2.bla=t3.bla)
> but this is not the best solution for me i think

I think you are looking for a natural join.


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[SQL] full join...using and version of pgsql

2004-04-14 Thread Tina Messmann
hello list,

i am using pgsql 7.2.1
i need something like
select * from t1 full join t2 using(bla) full join t3 using(bla)

i searched the archives and found that this is not possible with my 
version of postgres.
is this implemented in newer versions of postgres? since which version?

i'll try the alternative select * from t1 full join t2 on(t1.bla=t2.bla) 
full join t3 on(t1/t2.bla=t3.bla)
but this is not the best solution for me i think

regards
tina
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] SET idiom in insert statement

2004-04-14 Thread Kenneth Gonsalves
hi,
does any version of postgresql support the 'SET' idiom in an insert 
statement? Need this to generate an insert statement from a python dictionary
-- 
regards
kg
-- 
http://www.ootygolfclub.org

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


[SQL] type conversions

2004-04-14 Thread sad
hi

SELECT 'tbl'::regclass;
works fine

SELECT 'tbl'::text::regclass;
says cannot convert type text to regclass

what to do ?


---(end of broadcast)---
TIP 8: explain analyze is your friend


[SQL] Grant permission to all objects of user A to user B

2004-04-14 Thread kumar



Dear Friends,
 
Postgres 7.3.2.
 
I have an database with owner USRA who owns about 
300 objects (tables and functions). Now I want to give 'ALL' permission to all 
the objects of USRA to another database user USRB.
 
If I use the grant i need to type all the objects 
as comma separated, like the following
booktown=# GRANT ALL ON customers, books, editions, publishers
booktown-#   TO manager;
CHANGEIs there any other way do it. ThanksKumar