Re: [GENERAL] ECPG and COPY

2006-09-12 Thread Florian Weimer
* Bruce Momjian:

  Could you please explain what this has to do with my original question?
 
 I assumed that ECPG did something special with TO STDOUT, like other
 interfaces do.  This is not the case (that is, STDOUT is really
 standard output, so the functionality is not very useful.

 I am confused.  STDOUT is already implemented.

I wasn't aware of the fact that ECPG's implementation of STDOUT is
verbatim stdout (and not something similar to what DBD::Pg does).
This means both STDOUT and STDIN are not very useful (and STDIN even
less).

-- 
Florian Weimer[EMAIL PROTECTED]
BFK edv-consulting GmbH   http://www.bfk.de/
Durlacher Allee 47tel: +49-721-96201-1
D-76131 Karlsruhe fax: +49-721-96201-99

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Michael Meskes
On Mon, Mar 06, 2006 at 10:15:06AM -0500, Bruce Momjian wrote:
 Added for ecpg TODO:
 
o Add COPY TO STDIN / STDOUT handling

COPY TO STDOUT has been implemented, but I'm unsure whether COPY FROM
STDIN really makes sense. Does anyone know a real life example where
this would be needed and the work couldn't be done easier using psql?

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Florian Weimer
* Michael Meskes:

 COPY TO STDOUT has been implemented, but I'm unsure whether COPY FROM
 STDIN really makes sense. Does anyone know a real life example where
 this would be needed and the work couldn't be done easier using psql?

COPY FROM STDIN saves lots of network round-trips.

-- 
Florian Weimer[EMAIL PROTECTED]
BFK edv-consulting GmbH   http://www.bfk.de/
Durlacher Allee 47tel: +49-721-96201-1
D-76131 Karlsruhe fax: +49-721-96201-99

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Michael Meskes
On Wed, Aug 02, 2006 at 12:03:45PM +0200, Florian Weimer wrote:
 * Michael Meskes:
 
  COPY TO STDOUT has been implemented, but I'm unsure whether COPY FROM
  STDIN really makes sense. Does anyone know a real life example where
  this would be needed and the work couldn't be done easier using psql?
 
 COPY FROM STDIN saves lots of network round-trips.

So what?

Could you please explain what this has to do with my original question?
Somehow I don't get it, sorry.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

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

   http://archives.postgresql.org


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Bruce Momjian
Michael Meskes wrote:
 On Mon, Mar 06, 2006 at 10:15:06AM -0500, Bruce Momjian wrote:
  Added for ecpg TODO:
  
 o Add COPY TO STDIN / STDOUT handling
 
 COPY TO STDOUT has been implemented, but I'm unsure whether COPY FROM
 STDIN really makes sense. Does anyone know a real life example where
 this would be needed and the work couldn't be done easier using psql?

TODO updated:

o Add COPY TO STDIN handling

If you want the item removed, let me know.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 1: 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: [GENERAL] ECPG and COPY

2006-08-02 Thread Florian Weimer
* Michael Meskes:

 Could you please explain what this has to do with my original question?

I assumed that ECPG did something special with TO STDOUT, like other
interfaces do.  This is not the case (that is, STDOUT is really
standard output, so the functionality is not very useful.

-- 
Florian Weimer[EMAIL PROTECTED]
BFK edv-consulting GmbH   http://www.bfk.de/
Durlacher Allee 47tel: +49-721-96201-1
D-76131 Karlsruhe fax: +49-721-96201-99

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


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Bruce Momjian
Florian Weimer wrote:
 * Michael Meskes:
 
  Could you please explain what this has to do with my original question?
 
 I assumed that ECPG did something special with TO STDOUT, like other
 interfaces do.  This is not the case (that is, STDOUT is really
 standard output, so the functionality is not very useful.

I am confused.  STDOUT is already implemented.  It was STDIN that we
were asking if it was valuable.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

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


Re: [GENERAL] ECPG and COPY

2006-08-02 Thread Michael Meskes
On Wed, Aug 02, 2006 at 09:49:40AM -0400, Bruce Momjian wrote:
  I assumed that ECPG did something special with TO STDOUT, like other
  interfaces do.  This is not the case (that is, STDOUT is really
  standard output, so the functionality is not very useful.
 
 I am confused.  STDOUT is already implemented.  It was STDIN that we
 were asking if it was valuable.

Yes, I was asking about FROM STDIN. TO STDOUT has been added lately.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---(end of broadcast)---
TIP 1: 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: [GENERAL] ECPG and COPY

2006-03-06 Thread Bruce Momjian
Michael Meskes wrote:
   Yes, it's still an open report. Sorry, about that and all the other open
   bug reports/feature requests. I do not have the time at the moment to
   even reproduce bugs. Hopefully this will become better in the near
   future.
 
  Should we add this to TODO?  Anything else?
 
 Yes, please add it. I do have some more open bug reports/feature requests, 
 but 
 I'd like to reproduce things first before we add to the docs. Sometimes it's 
 easier to fix it than to add it. :-)

Added for ecpg TODO:

   o Add COPY TO STDIN / STDOUT handling

I think we should document _every_ thing that ecpg needs because it
helps existing users know what is missing, and encourages patches. 
Would you please supply a list?

-- 
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


Re: [GENERAL] ECPG and COPY

2006-02-26 Thread Michael Meskes
  Yes, it's still an open report. Sorry, about that and all the other open
  bug reports/feature requests. I do not have the time at the moment to
  even reproduce bugs. Hopefully this will become better in the near
  future.

 Should we add this to TODO?  Anything else?

Yes, please add it. I do have some more open bug reports/feature requests, but 
I'd like to reproduce things first before we add to the docs. Sometimes it's 
easier to fix it than to add it. :-)

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

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

   http://archives.postgresql.org


Re: [GENERAL] ECPG and COPY and PQputCopyData - don't get errors

2006-02-26 Thread Tom Lane
Wes [EMAIL PROTECTED] writes:
 I sent the column headers as the first line of the input.  While this I now
 know this is wrong, the problem here is that I got no error response back.
 ...
 However, every call to PQputCopyData, as well as PQputCopyEnd returned a
 result of 1.

That just indicates that the data was sent to the backend without error.
You forgot to check the copy command result afterward.

regards, tom lane

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [GENERAL] ECPG and COPY and PQputCopyData - don't get errors

2006-02-26 Thread Wes
On 2/26/06 12:12 PM, Tom Lane [EMAIL PROTECTED] wrote:

 That just indicates that the data was sent to the backend without error.
 You forgot to check the copy command result afterward.

Ok, after re-reading the docs for the 10th time, I see I missed that I need
to paragraph about calling 'PQgetResult' after the PQputCopyEnd.  I was just
checking the result and PQerrorMessage.  I think what threw me off was:

If a COPY command is issued via PQexec in a string that could contain
additional commands, the application must continue fetching results via
PQgetResult after completing the COPY sequence. Only when PQgetResult
returns NULL is it certain that the PQexec command string is done and it is
safe to issue more commands.

(looked like this was needed only if multiple commands were in the Pqexec)

and

PQgetResult
Waits for the next result from a prior PQsendQuery, PQsendQueryParams,
PQsendPrepare, or PQsendQueryPrepared call, and returns it.

(doesn't mention COPY).

I have it working now.  Thanks.

Wes



---(end of broadcast)---
TIP 1: 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: [GENERAL] ECPG and COPY

2006-02-24 Thread Michael Meskes
Am Freitag, 24. Februar 2006 05:26 schrieb Wes:
 I found this in the archives:

   http://archives.postgresql.org/pgsql-interfaces/2004-04/msg5.php

 With 8.x, is it still true that with ECPG, it is not possible to use COPY
 inline - I'd have to write the data to a file, then 'COPY FROM filename'
 (or use direct libpq API calls instead of ECPG)?

Yes, it's still an open report. Sorry, about that and all the other open bug 
reports/feature requests. I do not have the time at the moment to even 
reproduce bugs. Hopefully this will become better in the near future.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

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


Re: [GENERAL] ECPG and COPY

2006-02-24 Thread Bruce Momjian
Michael Meskes wrote:
 Am Freitag, 24. Februar 2006 05:26 schrieb Wes:
  I found this in the archives:
 
http://archives.postgresql.org/pgsql-interfaces/2004-04/msg5.php
 
  With 8.x, is it still true that with ECPG, it is not possible to use COPY
  inline - I'd have to write the data to a file, then 'COPY FROM filename'
  (or use direct libpq API calls instead of ECPG)?
 
 Yes, it's still an open report. Sorry, about that and all the other open bug 
 reports/feature requests. I do not have the time at the moment to even 
 reproduce bugs. Hopefully this will become better in the near future.

Should we add this to TODO?  Anything else?

-- 
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 1: 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: [GENERAL] ECPG and COPY

2006-02-23 Thread Michael Fuhr
On Thu, Feb 23, 2006 at 10:26:35PM -0600, Wes wrote:
 I found this in the archives:
 
   http://archives.postgresql.org/pgsql-interfaces/2004-04/msg5.php
 
 With 8.x, is it still true that with ECPG, it is not possible to use COPY
 inline - I'd have to write the data to a file, then 'COPY FROM filename' (or
 use direct libpq API calls instead of ECPG)?

Looks that way.  The ECPGexecute() function in ecpglib/execute.c
has the following code:

  case PGRES_COPY_OUT:
  ECPGlog(ECPGexecute line %d: Got PGRES_COPY_OUT ... tossing.\n, 
stmt-lineno);
  PQendcopy(stmt-connection-connection);
  break;
  case PGRES_COPY_IN:
  ECPGlog(ECPGexecute line %d: Got PGRES_COPY_IN ... tossing.\n, 
stmt-lineno);
  PQendcopy(stmt-connection-connection);
  break;

You can see this code being executed if you enable debugging:

% cat foo.pgc
int
main(void)
{
ECPGdebug(1, stdout);
EXEC SQL CONNECT TO test;
EXEC SQL COPY foo FROM stdin;
EXEC SQL COMMIT;
EXEC SQL DISCONNECT;
return 0;
}

% ./foo 
[33044]: ECPGdebug: set to 1
[33044]: ECPGconnect: opening database test on DEFAULT port DEFAULT 
[33044]: ECPGexecute line 6: QUERY: copy  foo  from stdinon connection test
[33044]: ECPGexecute line 6: Got PGRES_COPY_IN ... tossing.
[33044]: ECPGtrans line 7 action = commit connection = test
[33044]: ecpg_finish: Connection test closed.

-- 
Michael Fuhr

---(end of broadcast)---
TIP 1: 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