Re: PerformPortalClose warning in 7.3

From: Gerhard Haering <haering_postgresql(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PerformPortalClose warning in 7.3
Date: 2002-12-23 01:18:46
Message-ID: slrnb0cp0i.aji.haering_postgresql@lilith.my-fqdn.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces pgsql-performance

Michael Engelhart wrote in gmane.comp.db.postgresql.general:
> Hi -
> I've been running PostgreSQL 7.3 on Mac OS X 10.2 since it was released
> and it's been running fine. I'm using pyPgSQL 2.3 for client side
> programming which also was working great until tonight. Now whenever
> I do any query of any type, I get warnings like this:
>
> WARNING: PerformPortalClose: portal "pgsql_00179f10" not found
>
> It "appears" that everything is still working the way it was but it's a
> bit discomforting to have these show up on my screen while running my
> applications.
>
> Anyone that can explain this?
>
> Here's a tiny bit of Python sample code that I used to make sure it
> wasn't my other code causing the problems
>
> from pyPgSQL import PgSQL
>
> dbname = "template1"
> conn = PgSQL.connect(database=dbname)
> cursor = conn.cursor()
> sql = "SELECT now()";
> cursor.execute(sql)
> res = cursor.fetchall()
> for i in res:
> print i
> cursor.close()
> conn.commit()

Actually, pyPgSQL is using PostgreSQL portals behind your back. This
is a feature!

To show this, we use the undocumented, but very handy toggleShowQuery
flag. The effect is that we can see what SQL pyPgSQL sends to the
backend using libpq (the lines staring with QUERY: below):

#v+
gerhard(at)gargamel:~$ python
Python 2.2.2 (#1, Nov 30 2002, 23:19:58)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyPgSQL import PgSQL
>>> con = PgSQL.connect()
>>> con.conn.toggleShowQuery
'On'
>>> cursor = con.cursor()
QUERY: BEGIN WORK
>>> cursor.execute("select * from test")
QUERY: DECLARE "PgSQL_0811F1EC" CURSOR FOR select * from test
QUERY: FETCH 1 FROM "PgSQL_0811F1EC"
QUERY: SELECT typname, -1 , typelem FROM pg_type WHERE oid = 23
QUERY: SELECT typname, -1 , typelem FROM pg_type WHERE oid = 1043
>>> result = cursor.fetchmany(5)
QUERY: FETCH 4 FROM "PgSQL_0811F1EC"
>>> result
[[None, 'A'], [None, 'B'], [None, 'C'], [None, 'F'], [None, 'F']]
>>> con.commit()
QUERY: CLOSE PgSQL_0811F1EC
QUERY: COMMIT WORK
>>>
#v-

This gives me a warning like this:

#v+
WARNING: PerformPortalClose: portal "pgsql_0811f1ec" not found
#v-

As far as I can see, the SQL pyPgSQL emits is perfectly ok. But I'd be
glad to hear a clarification.

> strangely if I remove the last 2 lines (cursor.close() and
> conn.commit()) I don't get the errors.
>
> Also I don't notice that I don't have this problem with psql command
> line either. Is this the Python API causing this?

If you use the same SQL statements using portals in psql, you get the
same warning (obviously). I just tried.

Gerhard (pyPgSQL developer)
--
Favourite database: http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two: http://pypgsql.sf.net/
Embedded database for Python: http://pysqlite.sf.net/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-23 02:26:33 Re:
Previous Message Scott Lamb 2002-12-22 23:35:27 Re: ident auth not working on 7.3.1

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2002-12-23 02:36:27 Re: PerformPortalClose warning in 7.3
Previous Message Lee Kindness 2002-12-20 15:07:40 Re: [GENERAL] RPMS for Redhat 7.3 ??

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2002-12-23 02:36:27 Re: PerformPortalClose warning in 7.3
Previous Message Tom Lane 2002-12-21 20:28:22 Re: Speed Question