Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-21 Thread Tom Lane
Noah Misch writes: > On Wed, Aug 21, 2013 at 10:13:15AM -0400, Tom Lane wrote: >> The reason for that is you'd get randomly different results on another >> installation. In this particular application, I think David doesn't >> really care about what values he gets as long as they're distinct, >>

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-21 Thread Noah Misch
On Wed, Aug 21, 2013 at 10:13:15AM -0400, Tom Lane wrote: > Alexander Korotkov writes: > > It seems reasonable to me to cast enum to oid. However, creating casts > > without function isn't allowed for enums. > > > test=# create cast (source as oid) without function; > > ERROR: enum data types ar

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-21 Thread David E. Wheeler
On Aug 21, 2013, at 4:13 PM, Tom Lane wrote: >> test=# create cast (source as oid) without function; >> ERROR: enum data types are not binary-compatible > > The reason for that is you'd get randomly different results on another > installation. In this particular application, I think David does

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-21 Thread Tom Lane
Alexander Korotkov writes: > It seems reasonable to me to cast enum to oid. However, creating casts > without function isn't allowed for enums. > test=# create cast (source as oid) without function; > ERROR: enum data types are not binary-compatible The reason for that is you'd get randomly dif

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-21 Thread Alexander Korotkov
On Tue, Aug 20, 2013 at 8:53 PM, David E. Wheeler wrote: > On Aug 20, 2013, at 6:50 PM, Tom Lane wrote: > > > You need more parentheses -- (source::text) would've worked. > > Alas, no, same problem as for CAST(): > > ERROR: functions in index expression must be marked IMMUTABLE > > >> No probl

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-20 Thread David E. Wheeler
On Aug 20, 2013, at 6:50 PM, Tom Lane wrote: > You need more parentheses -- (source::text) would've worked. Alas, no, same problem as for CAST(): ERROR: functions in index expression must be marked IMMUTABLE >> No problem, I can use CAST(), right? So I try: >>EXCLUDE USING gist (CAS

Re: [HACKERS] CAST Within EXCLUSION constraint

2013-08-20 Thread Tom Lane
"David E. Wheeler" writes: > Well, maybe I can cast it? But no, changing the EXCLUDE line to > EXCLUDE USING gist (source::text WITH =, within WITH &&) > Yields a syntax error: > try.sql:13: ERROR: syntax error at or near "::" > LINE 4: EXCLUDE USING gist (source::text WITH =,

[HACKERS] CAST Within EXCLUSION constraint

2013-08-20 Thread David E. Wheeler
Hackers, I am trying to do something like this: CREATE TYPE source AS ENUM( 'fred', 'wilma', 'barney', 'betty' ); CREATE EXTENSION btree_gist; CREATE TABLE things ( source source NOT NULL, within tstzrange NOT NULL, EXCLUDE USING gist (source WITH