Re: [COMMITTERS] pgsql: Remove typename from A_Const.

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Remove typename from A_Const.
Date: 2008-04-29 20:07:38
Message-ID: 20080429200738.GJ5652@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom Lane escribió:
> alvherre(at)postgresql(dot)org (Alvaro Herrera) writes:
> > Remove typename from A_Const.
>
> I'm thinking this could be cleaned up further. The patch as applied
> removes the ::int4 typename decoration that had been inserted by
> makeIntConst(), while leaving in place the ::float8 decoration inserted
> by makeFloatConst(). The kindest thing that can be said about that
> is that it's inconsistent.

That's very kind, yes :-) I think that cast can be removed safely.

> Now as far as I can see in a look through
> gram.y, these routines (and makeAConst) were used only in places where
> the typename qualification was really unnecessary, that is typmods
> and GUC variable values and so on, not general expression contexts where
> we might really need to determine a data type for the constant. So what
> I'm thinking is that we should get rid of the ::float8 decoration too,
> and thereby be able to revert some of the ugly code added elsewhere such
> as guc.c.

Hmm, I'm not sure but I think the typecast is needed in the guc.c code
in order to pass the fact that the Const is an Interval. This is used
to process things such as

set time zone interval '-8:30' ;

Perhaps this can be detected by some other mechanism but currently it's
being driven by the cast.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-04-29 20:15:59 Re: [COMMITTERS] pgsql: Remove typename from A_Const.
Previous Message Alvaro Herrera 2008-04-29 19:37:13 pgsql: Fix REASSIGN OWNED so that it works on procedural languages too.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-29 20:15:59 Re: [COMMITTERS] pgsql: Remove typename from A_Const.
Previous Message Aidan Van Dyk 2008-04-29 20:01:44 Re: Protection from SQL injection