Re: record datatype comparisons - Mailing list pgsql-sql

From George Pavlov
Subject Re: record datatype comparisons
Date
Msg-id 8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net
Whole thread Raw
In response to Re: record datatype comparisons  (Andrew Sullivan <ajs@crankycanuck.ca>)
Responses Re: record datatype comparisons  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-sql
thanks fo the reply. i was misled by pgAdmin (1.6) giving both as
"record" in the datatype (i thought "row" and "?column?" were just "best
guess" column headers).

so, if they are indeed differently shaped is there any way to make them
be the same shape?

note that this one also fails with the same error (one would think these
are the "same shape"):

select  (select (1,2))
is distinct from  (select (1,2))
;

ERROR: operator does not exist: record = record
SQL state: 42883
Hint: No operator matches the given name and argument type(s). You may
need to add explicit type casts.



> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Andrew Sullivan
> Sent: Tuesday, October 31, 2006 1:23 PM
> To: pgsql-sql@postgresql.org
> Subject: Re: [SQL] record datatype comparisons
>
> On Tue, Oct 31, 2006 at 12:38:36PM -0800, George Pavlov wrote:
> > Both (1::int,'a'::varchar) and (select (2::int,'a'::varchar)) are of
> > type record, aren't they?
>
> I don't think so.  Psql gives you a hint that not:
>
> testing=# SELECT (1::int, 'a'::varchar);
>   row
> -------
>  (1,a)
> (1 row)
>
> testing=# SELECT (SELECT(1::int, 'a'::varchar));
>  ?column?
> ----------
>  (1,a)
> (1 row)
>
> Note the column headers.  They're differently shaped.  Because
> pseudotype record doesn't have a shape, equality doesn't make sense,
> so you need two shapes that are already identical, so they can use
> the matching rules for that.
>
> A
>
> --
> Andrew Sullivan  | ajs@crankycanuck.ca
> Everything that happens in the world happens at some place.
>         --Jane Jacobs


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: record datatype comparisons
Next
From: Volkan YAZICI
Date:
Subject: Re: record datatype comparisons