Re: [HACKERS] SPI example does not work for 7.1beta4

From: Limin Liu <limin(at)pumpkinnet(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, limin(at)pumpkinnet(dot)com
Subject: Re: [HACKERS] SPI example does not work for 7.1beta4
Date: 2001-03-23 02:00:10
Message-ID: 3ABAAE2A.FF926716@pumpkinnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Thanks Tom,

By the way, did you change the whole archetecture of SPI invocation?

I put
---
SPI_connect();
SPI_exec("create temp table tbl_tmp (n int);",0);
SPI_exec("insert into tbl_tmp values (1);",0);
SPI_finish();
---
after InitPostgres and before setsigjmp().
This works perfectly in my 7.03 and earlier version. That means, after authentication, we
will have a temp table per each db connection. User can use the client program to "select"
or "insert" upon this temp table.

However, the same code does not work in 7.1. Actually, I got some messages contradicting to
each other:
---
db1=> select * from tbl_tmp;
ERROR: Relation 'tbl_tmp' does not exist
db1=> create temp table tbl_tmp (n int);
ERROR: Relation 'tbl_tmp' already exists
db1=>
---

Can you please give us some hints on what's going on here?

Thanks

Tom Lane wrote:

> Limin Liu <limin(at)pumpkinnet(dot)com> writes:
> > I am learning and using SPI. In PostgreSQL documentation chapter "Server
> > Programming Interface," there is a small example name "execq(text,
> > int)".
> > This example works as the document says on 7.0.3 and earlier version,
> > but this example DOES NOT work on my 7.1 beta4.
>
> Hm. textout() can't be called that way anymore --- as indeed your compiler
> should have told you, if it's any good at all. I get
>
> execq.c: In function `execq':
> execq.c:13: warning: passing arg 1 of `textout' from incompatible pointer type
> execq.c:13: warning: passing arg 1 of `SPI_exec' makes pointer from integer without a cast
>
> Looks like the example is in need of update. Thanks for the report.
>
> regards, tom lane

--
LM Liu

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gunnar R|nning 2001-03-23 02:07:16 Re: Problem migrating dump to latest CVS snapshot.
Previous Message Michelle Murrain 2001-03-23 01:57:22 Re: Extreme Newbie Questions

Browse pgsql-hackers by date

  From Date Subject
Next Message Gunnar R|nning 2001-03-23 02:07:16 Re: Problem migrating dump to latest CVS snapshot.
Previous Message Tom Lane 2001-03-23 01:41:48 Re: Problem migrating dump to latest CVS snapshot.