Received: from yara.imsd.uni-mainz.de (yara.IMSD.Uni-Mainz.DE [134.93.144.68]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5Q5soa21194; Tue, 26 Jun 2001 01:54:50 -0400 (EDT) (envelope-from wagner@imsd.uni-mainz.de) Received: (from smap@localhost) by yara.imsd.uni-mainz.de (8.9.3/8.9.3/lxs_5.2) id HAA19110; Tue, 26 Jun 2001 07:53:11 +0200 Received: from hermes.imsd.uni-mainz.de(134.93.64.80) by yara.imsd.uni-mainz.de via smap (V2.1/2.1+anti-relay+anti-spam) id xma019104; Tue, 26 Jun 01 07:53:10 +0200 Received: from imsd.uni-mainz.de (unverified [134.93.64.34]) by hermes.imsd.uni-mainz.de (EMWAC SMTPRS 0.83) with SMTP id ; Tue, 26 Jun 2001 07:54:03 +0200 Message-ID: <3B382330.3D865E3@imsd.uni-mainz.de> Date: Tue, 26 Jun 2001 07:52:48 +0200 From: Markus Wagner Organization: IMSD X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i686) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-sql@postgresql.org" , pgsql-interfaces Subject: loosing connection after function call Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id f5Q5soa21196 X-Archive-Number: 200106/77 X-Sequence-Number: 1740 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: ... ... SELECT my_init(); ... 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