Skip site navigation (1) Skip section navigation (2)

pgsql/src/interfaces/libpgtcl pgtclId.c

From: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql/src/interfaces/libpgtcl pgtclId.c
Date: 2001-09-07 21:55:00
Message-ID: 200109072155.f87Lt0m78056@hub.org (view raw or flat)
Thread:
Lists: pgsql-committers
CVSROOT:	/home/projects/pgsql/cvsroot
Module name:	pgsql
Changes by:	scrappy(at)hub(dot)org	01/09/07 17:55:00

Modified files:
	src/interfaces/libpgtcl: pgtclId.c 

Log message:
	>has anyone ever successfully done copy to/from stdout with the
	>tcl-extension for postgreSQL.
	>I'm currently using 7.0 and always getting a seg fault when I try to
	>read from the database connection after issueing a "COPY table TO
	>stdout;" (I'm using the connection handle, *not* the result handle).
	>Maybe this is fixed in a later release.
	>The README file in src/interfaces/libpgtcl tells me, that this should
	>work, but unforunately it doesn't.
	
	Yes, it seems broken. It is a bug in libpgtcl.  Are you running Tcl >= 8.3.2?
	That's when the Tcl team changed the data structure for channel
	callbacks.  The change itself was designed to be backward compatible, but I
	suspect a related change made the code more sensitive to errors in the
	structure (NULL pointers where functions are required).  Either that, or
	nobody has tried to use libpgtcl with COPY in a long time.
	
	First, I have to say I can't think of a good reason to use PostgreSQL's
	COPY command from a Tcl application. I think it should only be used with
	psql for importing data from another source into PostgreSQL, or for
	exporting PostgreSQL data into another database (but why would anyone do
	that?) If it was me, I would stick with SELECT and INSERT and be "SQL
	Compliant".
	
	OK, editorial is over. Try applying the patch below to fix
	src/interfaces/libpgtcl/pgtclId.c
	and let us know if it works. I did little testing on it, but my test did
	segfault before and ran fine (copy in and copy out) after the patch.  This
	is for PostgreSQL-7.1.2 - since you are running older 7.0, I don't know if
	this will work, but I suspect it will.
	
	PS It's the absence of PgWatchProc which kills it. I didn't upgrade it
	to the "V2" channel type structure, so it should be compatible with older
	Tcl's. But aside from gets and puts, I doubt any other file operations
	would work on the handle during a copy.
	
	ljb


pgsql-committers by date

Next:From: Marc G. FournierDate: 2001-09-07 21:57:54
Subject: pgsql/ oc/src/sgml/ref/alter_table.sgml rc/bac ...
Previous:From: Marc G. FournierDate: 2001-09-07 21:45:43
Subject: pgsql/src/interfaces/jdbc TESTSUITE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group