Thread: bug found in 8.3 beta 3.

bug found in 8.3 beta 3.

From
"chris wood"
Date:
Hi, I found this bug? In beta 3.  I am not a Linux guru so installing any
betas in Debian is very painful for me.  Perhaps you could check to see if
it is still there in beta 4??



Last time I reported a bug
http://archives.postgresql.org/pgsql-committers/2007-11/msg00584.php

I did not get any direct feedback and only found it by fluke.  My pgsql-bugs
subscription is set

to "nomail".  Please reply directly to chrisj.wood@sympatico.ca



Here are the steps that demonstrate the problem:



drop  type t_tempbug_c cascade;

create type t_tempbug_c as (

    CONF_KEY              int4

   )

;

create or replace function tempbug_c()

       returns SETOF t_tempbug_c

       as $$

declare

begin

  drop table if exists temp_table cascade;

  create temporary table temp_table(a int);

  insert into temp_call_table values (7) ;

  return query

    select 0 from temp_call_table limit 1 ;

end;

$$ language plpgsql;



create or replace function tempbug()

       returns SETOF t_tempbug_c

       as $$

declare

  val int;

begin

  create temporary table temp_call_table (a int);

  perform tempbug_c() ;

  return query

    select * from temp_call_table ;

  drop table temp_call_table ;

end;

$$ language plpgsql;



protocal2=> select * from tempbug() ;

ERROR:  set-valued function called in context that cannot accept a set

CONTEXT:  PL/pgSQL function "tempbug_c" line 6 at RETURN QUERY SQL statement
"SELECT  tempbug_c()"

PL/pgSQL function "tempbug" line 5 at PERFORM



protocal2=> select version() ;

                                                     version

----------------------------------------------------------------------------
-------------------------------------

PostgreSQL 8.3beta3 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.3

20071014 (prerelease) (Debian 4.2.2-3)

(1 row)

Re: bug found in 8.3 beta 3.

From
Tom Lane
Date:
"chris wood" <chrisj.wood@sympatico.ca> writes:
> Hi, I found this bug? In beta 3.  I am not a Linux guru so installing any
> betas in Debian is very painful for me.  Perhaps you could check to see if
> it is still there in beta 4??

I see no bug here.  You're invoking a set-returning function from a
PERFORM, which is a scalar context (it's not different from SELECT
really).

If you make the PERFORM be

  perform * from tempbug_c() ;

then it doesn't complain.

            regards, tom lane

Re: bug found in 8.3 beta 3.

From
Dimitri Fontaine
Date:
Hi,

Le Monday 17 December 2007 19:05:36 chris wood, vous avez =E9crit=A0:
> Hi, I found this bug? In beta 3.  I am not a Linux guru so installing any
> betas in Debian is very painful for me.  Perhaps you could check to see if
> it is still there in beta 4??

The experimental sources of debian already provides postgresql-8.3 beta4, s=
o=20
installing it is as easy as adding experimental to your testing server=20
sources.list, or if you want to take no risk of upgrading other experimenta=
l=20
packages, adding the deb-src experimental source and backporting:
 apt-get update
 apt-get build-dep postgresql-common postgresql-client-common postgresql-8.3
 apt-get source -b postgresql-common postgresql-client-common postgresql-8.3
 dpkg -i ...

 http://packages.debian.org/postgresql-8.3

Install at least the -common packages, libpq and the wanted components.
Those -common packages contain the infamous debian wrappers which makes deb=
ian=20
differs from other PostgreSQL installations, but allows to easily use sever=
al=20
version at a time, including binary choice without messing with PATH manual=
ly=20
(adding --cluster 8.3/main to "official" options --- version/clustername).

Please note that 8.3b2 to 8.3b4 needs an initdb, and the debian packaging h=
as=20
no support for beta to beta upgrading. You'll certainly want to do it=20
manually:
 pg_dumpall > backup.file
 apt-get remove postgresql-8.3
 rm -rf $PGDATA/* (defaults to /var/lib/postgresql/8.3/main)
 <install new version, either apt-get install or dpkg -i>
 psql -f backup.file

Hope this helps,
--=20
dim