pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Custom type where not all elements are comparable
3+ messages / 3 participants
[nested] [flat]

* Custom type where not all elements are comparable
@ 2004-07-05 15:31 Markus Bertheau <twanger@bluetwanger.de>
  2004-07-05 16:32 ` Re: Custom type where not all elements are comparable Tom Lane <tgl@sss.pgh.pa.us>
  2004-07-05 19:39 ` Re: Custom type where not all elements are comparable Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 2 replies; 3+ messages in thread

From: Markus Bertheau @ 2004-07-05 15:31 UTC (permalink / raw)
  To: pgsql-sql

Hi,

Is it possible to define or implement a type in PostgreSQL not all
values of which are comparable to each other? In particular I'm thinking
of a duration type similar to the XML Schema duration type[1]. For
example P2D (2 days) is less than P4D (4 days), but P1M (1 month) and
P30D (30 days) are not comparable.

Thanks.

[1] http://www.w3.org/TR/xmlschema-2/#duration

-- 
Markus Bertheau <twanger@bluetwanger.de>




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Custom type where not all elements are comparable
  2004-07-05 15:31 Custom type where not all elements are comparable Markus Bertheau <twanger@bluetwanger.de>
@ 2004-07-05 16:32 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2004-07-05 16:32 UTC (permalink / raw)
  To: Markus Bertheau <twanger@bluetwanger.de>; +Cc: pgsql-sql

Markus Bertheau <twanger@bluetwanger.de> writes:
> Is it possible to define or implement a type in PostgreSQL not all
> values of which are comparable to each other?

Certainly, as long as you don't expect to be able to btree-index it,
sort it, or DISTINCT it.  (In theory we could probably handle DISTINCT
using hash aggregation, as long as equality behaves sanely; but that's
not implemented now.)

Probably it'd be reasonable for the comparison operators to return
NULL for a noncomparable pair of inputs.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Custom type where not all elements are comparable
  2004-07-05 15:31 Custom type where not all elements are comparable Markus Bertheau <twanger@bluetwanger.de>
@ 2004-07-05 19:39 ` Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2004-07-05 19:39 UTC (permalink / raw)
  To: Markus Bertheau <twanger@bluetwanger.de>; pgsql-sql

Markus Bertheau wrote:
> Is it possible to define or implement a type in PostgreSQL not all
> values of which are comparable to each other? In particular I'm
> thinking of a duration type similar to the XML Schema duration
> type[1]. For example P2D (2 days) is less than P4D (4 days), but P1M
> (1 month) and P30D (30 days) are not comparable.

Smells like the interval type.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-07-05 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-05 15:31 Custom type where not all elements are comparable Markus Bertheau <twanger@bluetwanger.de>
2004-07-05 16:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-07-05 19:39 ` Peter Eisentraut <peter_e@gmx.net>

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