pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: George Pavlov <gpavlov@mynewplace.com>
To: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: record datatype comparisons
Date: Tue, 31 Oct 2006 13:33:25 -0800
Message-ID: <8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net> (raw)
In-Reply-To: <20061031212253.GD20809@phlogiston.dyndns.org>

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 



view thread (10+ messages)  latest in thread

Message-ID: <8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net>
Permalink:  ../8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net/
Also on:    postgresql.org/message-id/8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gpavlov@mynewplace.com, ajs@crankycanuck.ca
  Subject: Re: record datatype comparisons
  In-Reply-To: <8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net>
  References: <20061031212253.GD20809@phlogiston.dyndns.org> <8C5B026B51B6854CBE88121DBF097A8655CBFB@ehost010-33.exch010.intermedia.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox