Re: record datatype comparisons

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Andrew Sullivan" <ajs(at)crankycanuck(dot)ca>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: record datatype comparisons
Date: 2006-10-31 21:33:25
Message-ID: 8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Andrew Sullivan
> Sent: Tuesday, October 31, 2006 1:23 PM
> To: pgsql-sql(at)postgresql(dot)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(at)crankycanuck(dot)ca
> Everything that happens in the world happens at some place.
> --Jane Jacobs

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Volkan YAZICI 2006-10-31 21:45:00 Re: record datatype comparisons
Previous Message Andrew Sullivan 2006-10-31 21:22:53 Re: record datatype comparisons