> -----Original Message-----
> From: vikas p verma [mailto:vvicky72@rediffmail.com]
> Sent: Monday, June 10, 2002 1:10 PM
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] PostGres Doubt
> 
> 
> Hi ,
> 
> I am extremely new to PostGreSql. If any one can please answer 
> this question of mine. I want to insert/update records into the 
> postgres database through C or perl code. The only condition is 
> that it should be efficient. Can anybody tell me the difference 
> between ecpg and libpq and which one should I work on for solving 
> my problem.
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

ECPG is single threading.  Hence, tools written in ECPG are a pain in
the neck if you want multiple threads of execution.  I recommend against
using it for any purpose except porting a single threading project that
already uses embedded SQL.  The embedded SQL interface for PostgreSQL is
a disaster.

The libpq functions are reentrant.  These will be useful for just about
any project.

If you are populating empty tables, then use the bulk copy interface.
It is orders of magnitude faster.
If you are going to completely replace the data in a table, drop the
table, create the table, and use the bulk copy interface.

Mon, 10 Jun 2002 14:08:22 -0700
"Dann Corbit" <DCorbit@connx.com>
Re: PostGres Doubt
Is libpq/PQconnectdb() reentrant?  I've tried repeatedly over time and 
it seems to incur segfaults every single time.

-d

Dann Corbit wrote:

>The libpq functions are reentrant.  These will be useful for just about
>any project.
>  
>


Mon, 10 Jun 2002 21:16:23 -0400
David Ford <david+cert@blue-labs.org>
Re: PostGres Doubt
On Mon, 10 Jun 2002, Dann Corbit wrote:

> If you are going to completely replace the data in a table, drop the
> table, create the table, and use the bulk copy interface.

Actually, that's a bad habit to get into.  Views disappear, as do triggers 
or constraints.  Better to 'truncate table' or 'delete from table'.  I 
know, I had a bear of a time with a nightly drop table;create table;copy 
data in script that I forgot about and built a nice new app on views.  
worked fine, came in the next morning, app was down...  


Tue, 11 Jun 2002 10:10:50 -0600 (MDT)
Scott Marlowe <scott.marlowe@ihs.com>
Re: PostGres Doubt
On Mon, Jun 10, 2002 at 02:08:22PM -0700, Dann Corbit wrote:
> ECPG is single threading.  Hence, tools written in ECPG are a pain in
> the neck if you want multiple threads of execution.  I recommend against

Did he say he wants to write a multi-threaded app?

> using it for any purpose except porting a single threading project that
> already uses embedded SQL.  The embedded SQL interface for PostgreSQL is
> a disaster.

Oh, that's what I call constructive critizism. I cannot remember you
filing any bug reports or asking for some special features. Wouldn't
that be the first step? And not calling other people's work a disaster.

> The libpq functions are reentrant.  These will be useful for just about
> any project.

Well if they are (I never checked myself) it shouldn't be too difficult
to make ecpg reentrant too.

> If you are going to completely replace the data in a table, drop the
> table, create the table, and use the bulk copy interface.

Oh great! Talking about valuable comments. Ever bothered to even ask if
they are using triggers, constraints, etc. before coming with such a
proposal?

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Wed, 12 Jun 2002 14:40:45 +0200
Michael Meskes <meskes@postgresql.org>
Re: PostGres Doubt
Good points; not sure why I didn't pick up on this too.

I should point out that I've seen code with heavy Oracle-isms brought
into PostgreSQL using ecpg with amazingly few changes. It is a great
piece of code; any large complaints should perhaps be directed at the
SQL standards themselves...

                      - Thomas

Wed, 12 Jun 2002 07:38:32 -0700
Thomas Lockhart <lockhart@fourpalms.org>
Re: PostGres Doubt