self defined data type "with limit"?

From: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: self defined data type "with limit"?
Date: 2007-06-27 12:08:43
Message-ID: 4682534B.3060202@wincor-nixdorf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 table_a(col_a mychar(10));

Background: I need a varchar(10) but with quasi numeric sort order
so that "2" appears before "10".
Therefore I thought I create a new type and a new operator class.
Any better way to perform this?

Regards,
Michael

--
WINCOR NIXDORF International GmbH
Retail Store Solutions
Wernerwerkdamm 16
13629 Berlin, Germany
Phone +49 (0) 30 5017-1386
Fax +49 (0) 30 5017-1305
E-Mail Michael(dot)Enke(at)wincor-nixdorf(dot)com

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: 33106 Paderborn, Heinz-Nixdorf-Ring 1
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Jürgen Wilde, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0031
Ust-ID Nr.: DE812927716
WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential information. If you are not the intended recipient or
have received this e-mail in error, please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-27 14:10:05 Re: Frustrating issue with PGXS
Previous Message Fabien COELHO 2007-06-27 11:02:45 Re: Frustrating issue with PGXS