Re: record datatype comparisons

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
Cc: George Pavlov <gpavlov(at)mynewplace(dot)com>, Andrew Sullivan <ajs(at)crankycanuck(dot)ca>, pgsql-sql(at)postgresql(dot)org
Subject: Re: record datatype comparisons
Date: 2006-11-01 14:32:35
Message-ID: 20061101143235.GB25856@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 31, 2006 at 11:58:08PM +0200, Volkan YAZICI wrote:
> On Oct 31 06:49, Alvaro Herrera wrote:
> > > select
> > > (select (1,2))
> > > is distinct from
> > > (select (1,2))
> > > ;

> > alvherre=# select
> > row(1,2)
> > is distinct from
> > row(1,2)
>
> What's the difference between "SELECT (1, 2);" and "SELECT ROW(1, 2);"?

It's not the difference between SELECT (1,2) and SELECT ROW(1,2)
that's relevant, but the difference between SELECT (SELECT (1,2)) and
SELECT ROW(1,2).

The row's datatype(s) is(are) defined. The record's datatype isn't.
So you can have an equality operator for the row. You can see this
from the error message when you do this:

testing=# SELECT ROW(1,2) is distinct from ROW ('a','b');
ERROR: invalid input syntax for integer: "a"

This is part of the subtle difference between the record and row
datatypes.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
The plural of anecdote is not data.
--Roger Brinner

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Raghuraman K 2006-11-01 16:17:44 Distribution of results
Previous Message Andrew Sullivan 2006-11-01 14:28:33 Re: record datatype comparisons