Re: 8.3 PLpgSQL Can't Compare Records? - Mailing list pgsql-hackers

From Albe Laurenz
Subject Re: 8.3 PLpgSQL Can't Compare Records?
Date
Msg-id D960CB61B694CF459DCFB4B0128514C202FF66A7@exadv11.host.magwien.gv.at
Whole thread Raw
In response to 8.3 PLpgSQL Can't Compare Records?  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: 8.3 PLpgSQL Can't Compare Records?
List pgsql-hackers
David E. Wheeler wrote:
> This code:
>
>      CREATE OR REPLACE FUNCTION foo() returns boolean as $$
>      DECLARE
>          have_rec record;
>          want_rec record;
>      BEGIN
>          have_rec := row(1, 2);
>          want_rec := row(3, 5);
>          RETURN have_rec IS DISTINCT FROM want_rec;
>      END;
>      $$ language plpgsql;
>
>      SELECT ROW(1, 2) IS DISTINCT FROM ROW(3, 5);
>
>      SELECT foo();
>      DROP FUNCTION foo();
>
> Works as expected on 8.4, outputting:
>
[...]
>
> On 8.3, however, the row comparisons in the SQL statement works, but
> fails in the PL/pgSQL function, with this output:
>
>       ?column?
>      ----------
>       t
>      (1 row)
>
>      psql:huh.sql:14: ERROR:  operator does not exist: record = record
>      LINE 1: SELECT   $1  IS DISTINCT FROM  $2
>                           ^
>      HINT:  No operator matches the given name and argument type(s).  You might need to add explicit type casts.
>      QUERY:  SELECT   $1  IS DISTINCT FROM  $2
>      CONTEXT:  PL/pgSQL function "foo" line 7 at RETURN
>
>
> Is this a known issue in 8.3? If so, is there a known workaround?

The change is probably here:
http://archives.postgresql.org/pgsql-committers/2008-10/msg00110.php

So I think it is safe to argue that this is not a bug in 8.3, but an improvement in 8.4.

Yours,
Laurenz Albe


pgsql-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Maintenance Policy?
Next
From: Michael Meskes
Date:
Subject: Re: ECPG support for string pseudo-type