Re: [HACKERS] self defined data type with limit?

2007-06-29 Thread Michael Enke
If you want ORDER BY on the column to default to your custom ordering, the only way is a distinct datatype that you can make your custom opclass be the default for. The domain idea might work, I'm not totally sure. Defining functions/operators on a domain is a bit ticklish because anything but

Re: [HACKERS] self defined data type with limit?

2007-06-28 Thread Michael Enke
Heikki Linnakangas wrote: Michael Enke wrote: My primary goal is to get quasi numeric ordering on text column, e.g. 1 2 10 Normal order with varchar would be 1 10 2 You don't need to custom type for that. A custom operator class with custom comparison operators is enough. Ok, I tried

Re: [HACKERS] self defined data type with limit?

2007-06-28 Thread Tom Lane
Michael Enke [EMAIL PROTECTED] writes: Heikki Linnakangas wrote: You don't need to custom type for that. A custom operator class with custom comparison operators is enough. Ok, I tried with ordinary varchar and my own operators/op class. But than: 1) the index is never used (I created it

[HACKERS] self defined data type with limit?

2007-06-27 Thread Michael Enke
Hello everyone, I have created a new data type mychar. How can I specify a limit for it? This (unlimited version) works fine: create table table_a(col_a mychar); This gives an error: create table table_a(col_a mychar(10)); ERROR: syntax error at or near ( bei Zeichen 34 ZEILE 1: create table

Re: [HACKERS] self defined data type with limit?

2007-06-27 Thread Martijn van Oosterhout
On Wed, Jun 27, 2007 at 02:08:43PM +0200, Michael Enke wrote: Hello everyone, I have created a new data type mychar. How can I specify a limit for it? This (unlimited version) works fine: create table table_a(col_a mychar); What you want is called user defined typmod and I don't beleive any

Re: [HACKERS] self defined data type with limit?

2007-06-27 Thread Joshua D. Drake
Martijn van Oosterhout wrote: On Wed, Jun 27, 2007 at 02:08:43PM +0200, Michael Enke wrote: Hello everyone, I have created a new data type mychar. How can I specify a limit for it? This (unlimited version) works fine: create table table_a(col_a mychar); What you want is called user defined

Re: [HACKERS] self defined data type with limit?

2007-06-27 Thread Michael Enke
Joshua D. Drake wrote: Martijn van Oosterhout wrote: On Wed, Jun 27, 2007 at 02:08:43PM +0200, Michael Enke wrote: Hello everyone, I have created a new data type mychar. How can I specify a limit for it? This (unlimited version) works fine: create table table_a(col_a mychar); What

Re: [HACKERS] self defined data type with limit?

2007-06-27 Thread Heikki Linnakangas
Michael Enke wrote: My primary goal is to get quasi numeric ordering on text column, e.g. 1 2 10 Normal order with varchar would be 1 10 2 You don't need to custom type for that. A custom operator class with custom comparison operators is enough. -- Heikki Linnakangas EnterpriseDB