Re: Domains and supporting functions - Mailing list pgsql-hackers

From elein
Subject Re: Domains and supporting functions
Date
Msg-id 20060219205935.GJ15582@varlena.com
Whole thread Raw
In response to Re: Domains and supporting functions  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Domains and supporting functions
List pgsql-hackers
On Sun, Feb 19, 2006 at 07:57:42PM +0100, Martijn van Oosterhout wrote:
> On Sun, Feb 19, 2006 at 10:34:02AM -0800, elein wrote:
> > Actually I can do and have done this.  It is being tested now.
> > I did create an opclass.  It creates a UNIQUE index just fine
> > for the type using the lower() functionality.  *If* it passes 
> > all of my testing I'll publish it tomorrow on general bits.  
> > Perhaps folks can help try to break it when I publish (or
> > if you are around today Sunday, you can test in advance--email me
> > directly.)
> 
> How is this different from the citext module I suggested?
> 

My implementation is in SQL and plperl only.  Also, the lower
case comparisons are only one aspect of the datatype.


> > Now my only complaint is that ORDER BY requires the USING op
> > when it should recognize the information in the opclass for
> > btree > and < for the type of the sort column.  I can explain 
> > why it doesn't recognize the opclass information, but I think 
> > it should.
> 
> ORDER BY x ASC is a synonym for ORDER BY x USING >. That's the way it
> is currently. To use ORDER BY by itself you need to call your operators
> < and >.
> 

This does not work where x is datatype foo with opclass foo_ops.
In this case, it uses the text > instead of the foo >.

> > Type inheritance for base types should work by inheriting all of the
> > parent's definitions and overriding them only as necessary.  What I'm
> > trying to do is to demonstrate that we can weasle this functionality
> > using domains.
> 
> Well, you can kind of do this by creating an implicit cast from your
> type to text. Then you can use your type anywhere where text can appear
> (like strpos, length, etc).
> 

Yes, I'm leveraging most of the text functions.

> Hope this helps,
> -- 
> Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.




pgsql-hackers by date:

Previous
From: Douglas McNaught
Date:
Subject: Re: pg_service.conf
Next
From: uwcssa
Date:
Subject: postgresql query string length limit