Skip site navigation (1) Skip section navigation (2)

Re: Custom type with width specifier

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Shachar Shemesh <psql(at)shemesh(dot)biz>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom type with width specifier
Date: 2004-06-29 10:19:36
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
On P, 2004-06-27 at 17:53, Tom Lane wrote:
> Shachar Shemesh <psql(at)shemesh(dot)biz> writes:
> > What do I need to do in order to get the width specifier into my type? 
> Rewrite the grammar.  Width modifiers are only supported on types that
> are hard-wired into the grammar, mainly because they look way too much
> like function calls to be distinguished without special hacking.
> Consider for example the implications of the fact that this works:
> regression=# select numeric(17,10) '1.23';
>    numeric
> --------------
>  1.2300000000
> (1 row)
> bison has to decide *before scanning beyond the left parenthesis*
> whether "numeric" is a function name or a type name.
> If you can think of a more general solution, I'm all ears, but it looks
> like a hard problem that would require considerable rethinking of the
> present grammar for these things.

can't we make type(width) an actual function which returns another type

this would make it even possible to add support for things like
NUMBER(17,10) as an alias for NUMERIC(17,10) as an user-level addon.


In response to

pgsql-hackers by date

Next:From: Darko PrenosilDate: 2004-06-29 10:51:19
Subject: INSERT rule
Previous:From: jacob koehler (RRes-Roth)Date: 2004-06-29 10:11:22
Subject: Re: recursive SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group