Unix Technical Forum

BUG #2079: strage PREPARE/EXECUTE behavior

This is a discussion on BUG #2079: strage PREPARE/EXECUTE behavior within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2079 Logged by: Yuriy Vostrikoff Email address: mon@lcpi.ru PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:31 AM
Yuriy Vostrikoff
 
Posts: n/a
Default BUG #2079: strage PREPARE/EXECUTE behavior


The following bug has been logged online:

Bug reference: 2079
Logged by: Yuriy Vostrikoff
Email address: mon@lcpi.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.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:31 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2079: strage PREPARE/EXECUTE behavior

"Yuriy Vostrikoff" <mon@lcpi.ru> writes:
> EXECUTE return wrong result after ALTER TABLE ALTER COLUMN TYPE. Is this
> expected behavior?


The prepared plan really should be invalidated by the ALTER, but we
don't currently have any infrastructure that would allow that to happen.
I think Neil Conway is looking into it for 8.2, though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com