Unix Technical Forum

BUG #2678: Create or replace function with OUT args

This is a discussion on BUG #2678: Create or replace function with OUT args within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2678 Logged by: Jeff Trout Email address: threshar@torgo.978.org 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:16 AM
Jeff Trout
 
Posts: n/a
Default BUG #2678: Create or replace function with OUT args

The following bug has been logged online:

Bug reference: 2678
Logged by: Jeff Trout
Email address: threshar@torgo.978.org
PostgreSQL version: 8.1.4
Operating system: OSX 10.4.8 (Also occurs on FC4 w/kernel 2.6.16
Description: Create or replace function with OUT args
Details:

it seems there may be some bug with cache coherency when replacing
functions
that use OUT arguments. This happens on Linux (2.6.16 ) - same
version of
PG. (I didn't test across the pg restart as others are using that
system).
I've created and replaced hundreds of "normal" functions. so I think
it has
to do with OUT params.

Here's a transcript:

skittlebrau:/tmp postgres$ cat broken2.sql
create or replace function cachebroken(p_id int, out o_val1 int, out
o_val2
int)
as $$
BEGIN

o_val1 := 12;
o_val2 := 45;

END
$$
language 'plpgsql';
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \q
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

indie=# \i broken2.sql
psql:broken2.sql:10: ERROR: missing cache data for cache id 27
indie=# \i broken2.sql
psql:broken2.sql:10: ERROR: missing cache data for cache id 27
indie=# \q
skittlebrau:/tmp postgres$ pg_ctl -D /usr/local/pgsql/data/ -m fast
restart
waiting for postmaster to shut down....LOG: logger shutting down
done
postmaster stopped
postmaster starting
skittlebrau:/tmp postgres$ psql indie
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

indie=# \i broken2.sql
psql:broken2.sql:10: ERROR: missing cache data for cache id 27
indie=# drop function cachebroken (int);
DROP FUNCTION
indie=# \i broken2.sql
CREATE FUNCTION
indie=# \q

Occurs on: indie=# select version();

version

------------------------------------------------------------------------
----
------------------------------------------------------------------
PostgreSQL 8.1.4 on powerpc-apple-darwin8.8.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build
5026)
(1 row)

indie=# select version();
version

------------------------------------------------------------------------
----
-----------------------
PostgreSQL 8.1.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1
20050727 (Red Hat 4.0.1-5)
(1 row)



a couple of the guys on irc have confirmed it on HEAD as well.
--
Jeff Trout <jeff@jefftrout.com>
http://www.dellsmartexitin.com/
http://www.stuarthamm.net/




---------------------------(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
  #2 (permalink)  
Old 04-10-2008, 10:16 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2678: Create or replace function with OUT args

Jeff Trout <threshar@real.jefftrout.com> writes:
> it seems there may be some bug with cache coherency when replacing
> functions that use OUT arguments.


Looks like SysCacheGetAttr is making an assumption no longer tenable
(if it ever was), namely that the caller is referencing the same
syscache the tuple was fetched from, rather than another one on the
same catalog. It needs to be prepared to initialize the cache in case
this is the first reference. Will fix.

regards, tom lane

---------------------------(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
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 09:48 PM.


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