pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
loosing connection after function call
2+ messages / 2 participants
[nested] [flat]

* loosing connection after function call
@ 2001-06-26 05:52 Markus Wagner <wagner@imsd.uni-mainz.de>
  2001-06-26 14:32 ` Re: [SQL] loosing connection after function call Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Markus Wagner @ 2001-06-26 05:52 UTC (permalink / raw)
  To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>; pgsql-interfaces

Hi,

I would like to put one table create command into a C function
"my_init", just to provide a simple interface for all tables where these
tables are needed. When I execute "select my_init();" I loose the
database connection (pgaccess). Using psql -f I get the errors below. I
reduced the complexity of my table and I found out: The error occurrs,
as soon as I have a "SERIAL" type within my statement. A simple "CREATE
TABLE atl (idx INT);" runs fine, but "CREATE TABLE (idx SERIAL);"
crashes.

Here is my C function:

bool my_init ()
{
 if (SPI_connect () < 0)
  return (0);

 SPI_exec ("CREATE TABLE atl (idx SERIAL);",0);
 SPI_finish ();

 return (1);
}

Here is my SQL code that I execute using psql -f:

...
<some create tables>
...
SELECT my_init();
...
<other commands>

Here is the error:

psql:sql/test.sql:19: NOTICE:  CREATE TABLE will create implicit
sequence 'atl_idx_seq' for SERIAL column 'atl.idx'
psql:sql/test.sql:19: NOTICE:  CREATE TABLE/UNIQUE will create implicit
index 'atl_idx_key' for table 'atl'
psql:sql/test.sql:19: NOTICE:  mdopen: couldn't open HÛH$5@ÿÿÿÿ: No
such file or directory
psql:sql/test.sql:19: ERROR:  RelationClearRelation: relation 1034879
deleted while still in use
ERROR:  cannot open relation HÛH$5@ÿÿÿÿ
FATAL 2:  elog: error during error recovery, giving up!
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
psql:sql/test.sql:19: connection to server was lost
make: *** [dbs] Error 2

Please help!
Thank you,

Markus Wagner



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] loosing connection after function call
  2001-06-26 05:52 loosing connection after function call Markus Wagner <wagner@imsd.uni-mainz.de>
@ 2001-06-26 14:32 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-06-26 14:32 UTC (permalink / raw)
  To: Markus Wagner <wagner@imsd.uni-mainz.de>; +Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>; pgsql-interfaces

Markus Wagner <wagner@imsd.uni-mainz.de> writes:
> I would like to put one table create command into a C function
> "my_init", just to provide a simple interface for all tables where these
> tables are needed. When I execute "select my_init();" I loose the
> database connection (pgaccess).

What Postgres version?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-06-26 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-26 05:52 loosing connection after function call Markus Wagner <wagner@imsd.uni-mainz.de>
2001-06-26 14:32 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox