Re: record datatype comparisons

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: record datatype comparisons
Date: 2006-11-01 14:28:33
Message-ID: 20061101142833.GA25856@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 31, 2006 at 11:45:00PM +0200, Volkan YAZICI wrote:
> >
> > 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.
>
> Can you be more verbose please? I couldn't understand what you mean with
> "shape".

It's an analogy, really. The datatype numeric() for instance, is
determined. Because it's determined, you can have determinate rules
for comparing one to another.

But the pseudotype record doesn't work that way. It can accept
whatever you put in there, which is why you can define a variable as
type record, and then select from different tables (or even different
datatypes!) to it in plpgsql: it accommodates these different things.
The trade-off is that comparing a record to another record won't
always work: because what a record is is not pre-determined, you
can't have determinate rules for comparing one record to another.
And without determinate rules, you can't have an equality operator.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
This work was visionary and imaginative, and goes to show that visionary
and imaginative work need not end up well.
--Dennis Ritchie

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2006-11-01 14:32:35 Re: record datatype comparisons
Previous Message Ezequias Rodrigues da Rocha 2006-11-01 12:06:17 Re: Round Numeric Type