Re: record datatype comparisons

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: record datatype comparisons
Дата
Msg-id 20061101143235.GB25856@phlogiston.dyndns.org
обсуждение исходный текст
Ответ на Re: record datatype comparisons  (Volkan YAZICI <yazicivo@ttnet.net.tr>)
Список 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@crankycanuck.ca
The plural of anecdote is not data.    --Roger Brinner


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: record datatype comparisons
Следующее
От: Craig Servin
Дата:
Сообщение: Statement Triggers and access to other rows in the transaction