Thread: Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Bruce Momjian
Date:
Thierry Missimilly wrote:
> Thank you Bruce.
> You've had a good idea to send me your little program.
> I well understand the concept of "Named connection for each thread", but could you tell me where i can find a doc
wherethe use of "EXEC SQL AT
 
> ..." is describe ?
> 
> May i suggest to put some lines about that in the "Programmer's Guide" ?4 ECPG - Embedded SQL in C, as I have based
mydevelopment on this doc
 
> and it could be useful for other user to know how to code in Multi-thread context.

Yes, our docs are petty sparse on ecpg.  It is basically the same as
SQL-standard embedded C, so any docs on that would be the same for ecpg.

Interfaces list, where is there detailed ecpg documentaiton, like
documentation on the AT clause?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Philip Yarra
Date:
On Thu, 13 Nov 2003 03:16 pm, Bruce Momjian wrote:
> Interfaces list, where is there detailed ecpg documentaiton, like
> documentation on the AT clause?

I'm willing to have a go at updating the doco. Can someone point me to a guide
to getting started with the markup we use?

Regards, Philip.


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Bruce Momjian
Date:
Philip Yarra wrote:
> On Thu, 13 Nov 2003 03:16 pm, Bruce Momjian wrote:
> > Interfaces list, where is there detailed ecpg documentaiton, like
> > documentation on the AT clause?
> 
> I'm willing to have a go at updating the doco. Can someone point me to a guide 
> to getting started with the markup we use? 

Great, but be warned --- the work is huge.  Basically, ecpg is a full
ANSI SQL-standard C interface to PostgreSQL.  It is the only ANSI
standard application interface we support, I think.  Let me also add
that it is totally cool!  It doesn't look all that friendly, but once
you start coding in it, and pass variables in and out of queries, it
takes on amazing power and has amazing clarity.  If I was coding an app
in C, it would be the interface I would use.  libpq requires just too
much house-cleaning for me.

Anyway, I think you can grab any ANSI SQL enbedded document and get
ideas.  You can look at vendors docs because those are going to be very
similar, and you can look at the ANSI standard for ideas.  Of course,
check out what you see against our existing grammer to be sure we
support it, but once you are done, I think you could create a document
that really shows the power of ecpg --- right now, our docs don't do it
justice.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Bruce Momjian
Date:
Philip Yarra wrote:
> On Thu, 13 Nov 2003 03:16 pm, Bruce Momjian wrote:
> > Interfaces list, where is there detailed ecpg documentaiton, like
> > documentation on the AT clause?
> 
> I'm willing to have a go at updating the doco. Can someone point me to a guide 
> to getting started with the markup we use? 

You can just write it and we can add markup, or you can add SGML tags ---
just use tags from similar sections as examples of how to do it --- at
least that's how I do it, then Peter cleans it up for me.  :-)

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Philip Yarra
Date:
On Thu, 13 Nov 2003 03:47 pm, Bruce Momjian wrote:
> Philip Yarra wrote:
> > I'm willing to have a go at updating the doco. Can someone point me to a
> > guide to getting started with the markup we use?
>
> Great, but be warned --- the work is huge.

Yikes! I just figured updating the manual section would be a good start. I'll
deal with *huge* later.

> Let me also add
> that it is totally cool!  It doesn't look all that friendly, but once
> you start coding in it, and pass variables in and out of queries, it
> takes on amazing power and has amazing clarity.

Personally I don't really like embedded SQL, and would prefer libpq, except
for one beautiful feature: it's quite portable (Informix->Sybase->PostgreSQL
with minimal re-coding).

> Anyway, I think you can grab any ANSI SQL enbedded document and get
> ideas.  You can look at vendors docs because those are going to be very
> similar, and you can look at the ANSI standard for ideas.

I have some of the vendors' ones to look at for ideas.

Is the ANSI doc (freely) available?

> that really shows the power of ecpg --- right now, our docs don't do it
> justice.

Agreed. I'll see what I can do. I figure just adding "always use 'AT
connection_name' in a threaded application or suffer the consequences" would
be a good start.

Regards, Philip.




Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Bruce Momjian
Date:
Philip Yarra wrote:
> On Thu, 13 Nov 2003 03:47 pm, Bruce Momjian wrote:
> > Philip Yarra wrote:
> > > I'm willing to have a go at updating the doco. Can someone point me to a
> > > guide to getting started with the markup we use?
> >
> > Great, but be warned --- the work is huge.  
> 
> Yikes! I just figured updating the manual section would be a good start. I'll 
> deal with *huge* later.
> 
> > Let me also add
> > that it is totally cool!  It doesn't look all that friendly, but once
> > you start coding in it, and pass variables in and out of queries, it
> > takes on amazing power and has amazing clarity.  
> 
> Personally I don't really like embedded SQL, and would prefer libpq, except 
> for one beautiful feature: it's quite portable (Informix->Sybase->PostgreSQL 
> with minimal re-coding). 
> 
> > Anyway, I think you can grab any ANSI SQL enbedded document and get
> > ideas.  You can look at vendors docs because those are going to be very
> > similar, and you can look at the ANSI standard for ideas.  
> 
> I have some of the vendors' ones to look at for ideas.
> 
> Is the ANSI doc (freely) available? 

Just grab a draft as mentioned in our developers FAQ.

> > that really shows the power of ecpg --- right now, our docs don't do it
> > justice.
> 
> Agreed. I'll see what I can do. I figure just adding "always use 'AT 
> connection_name' in a threaded application or suffer the consequences" would 
> be a good start. 

I guess, but there still a lot missing.  I wonder if we should just find
a good document on the web and point people there --- why reinvent the
wheel.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Michael Meskes
Date:
On Thu, Nov 13, 2003 at 03:35:31PM +1100, Philip Yarra wrote:
> On Thu, 13 Nov 2003 03:16 pm, Bruce Momjian wrote:
> > Interfaces list, where is there detailed ecpg documentaiton, like
> > documentation on the AT clause?
> 
> I'm willing to have a go at updating the doco. Can someone point me to a guide 
> to getting started with the markup we use? 

It's SGML. The file in question is pgsql/doc/src/sgml/ecpg.sgml.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: [GENERAL] Postgres 7.4 : ECPG not Thread-safe

From
Michael Meskes
Date:
On Wed, Nov 12, 2003 at 11:16:10PM -0500, Bruce Momjian wrote:
> Yes, our docs are petty sparse on ecpg.  It is basically the same as
> SQL-standard embedded C, so any docs on that would be the same for ecpg.
> 
> Interfaces list, where is there detailed ecpg documentaiton, like
> documentation on the AT clause?

Our docs say:
... <para>  The first option is to explicitly choose a connection for each SQL  statement, for example
<programlisting>
EXEC SQL AT <replaceable>connection-name</replaceable> SELECT ...;
</programlisting>  This option is particularly suitable if the application needs to  use several connections in mixed
order.</para>
 

So it's not as if it wasn't noted at all. Okay, this is in 7.4, 7.3 docs
are not nearly as good as Peter spend some time enhancing the docs for
7.4.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!