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

BUG #2079: strage PREPARE/EXECUTE behavior

From: "Yuriy Vostrikoff" <mon(at)lcpi(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2079: strage PREPARE/EXECUTE behavior
Date: 2005-11-30 09:38:01
Message-ID: 20051130093801.7111CF0B09@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2079
Logged by:          Yuriy Vostrikoff
Email address:      mon(at)lcpi(dot)ru
PostgreSQL version: 8.1.0
Operating system:   Debian sarge
Description:        strage PREPARE/EXECUTE behavior
Details: 

EXECUTE return wrong result after ALTER TABLE ALTER COLUMN TYPE. Is this
expected behavior?

mon=> select version();
                                          version                           
              
----------------------------------------------------------------------------
---------------
 PostgreSQL 8.1.0 on i386-pc-linux-gnu, compiled by GCC cc (GCC) 3.3.5
(Debian 1:3.3.5-13)
(1 row)

mon=> \d
No relations found.
mon=> create table test (col timestamp);
CREATE TABLE
mon=> insert into test values(current_timestamp);
INSERT 0 1
mon=> insert into test values(current_timestamp);
INSERT 0 1
mon=> prepare q as select * from test;
PREPARE
mon=> EXECUTE q;
            col             
----------------------------
 2005-11-30 12:27:49.569859
 2005-11-30 12:27:51.463482
(2 rows)

mon=> alter table test alter col type text;
ALTER TABLE
mon=> execute q;
             col              
------------------------------
 123450-10-10 15:43:18.790174
 123450-10-10 15:43:18.790174
(2 rows)

mon=> select * from test;
            col             
----------------------------
 2005-11-30 12:27:49.569859
 2005-11-30 12:27:51.463482
(2 rows)


'123450-10-10 15:43:18.790174' is certainly not '2005-11-30
12:27:49.569859'.

Same problem with other datatypes.
And a second question: why  PQprepare() from libpq returns empty PQresult?
It's useful to know field number, field types before PQexecutePrepared.

Responses

pgsql-bugs by date

Next:From: Muhamamd Irfan AzamDate: 2005-11-30 09:48:37
Subject: LibPQ Error.
Previous:From: Dirk Lutzeb├ĄckDate: 2005-11-30 09:06:05
Subject: Re: pg_dump: schema with OID 559701082 does not exist

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