Re: Custom type with width specifier

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Shachar Shemesh <psql(at)shemesh(dot)biz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom type with width specifier
Date: 2004-06-27 14:53:19
Message-ID: 11995.1088347999@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2004-06-27 14:56:32 Re: Custom type with width specifier
Previous Message Tom Lane 2004-06-27 14:42:46 Re: Fixing pg_dump