Re: [HACKERS] Re: [PORTS] Port Bug Report: int2 negative numbers not parsed correctly

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: hackers(at)postgresql(dot)org, mdalphin(at)sanger(dot)otago(dot)ac(dot)nz
Subject: Re: [HACKERS] Re: [PORTS] Port Bug Report: int2 negative numbers not parsed correctly
Date: 1998-04-01 16:41:45
Message-ID: 199804011641.LAA20424@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > > Well we maybe can, but it sure is ugly. This will be spread around a
> > > bunch of places (everywhere there is a unary minus allowed). I
> > > already did the wrong thing and brute-forced something similar into
> > > the CREATE SEQUENCE code in gram.y. Isolating it in transform_expr()
> > > or somewhere like that would be much cleaner.
> > But isn't it is just one line in gram.y. That is where I was seeing
> > it happen.
>
> golem$ grep UMINUS gram.y
> %right UMINUS
> | '-' default_expr %prec UMINUS
> | '-' constraint_expr %prec UMINUS
> | '-' a_expr %prec UMINUS
> | '-' b_expr %prec UMINUS
> | '-' position_expr %prec UMINUS
>
> So at least 5 different places, perhaps more when you get into it :(

OK, let's take a look at it. The only one I have seen a problem with
is:

| '-' a_expr %prec UMINUS

But let's look at the others. Default_expr has it:

default_expr: AexprConst
{ $$ = makeConstantList((A_Const *) $1); }
| NULL_P
{ $$ = lcons( makeString("NULL"), NIL); }
| '-' default_expr %prec UMINUS
{ $$ = lcons( makeString( "-"), $2); }

But I don't understand why it is there. Doesn't AexprConst handle such
a case, or do we get shift-reduce conflicts without it?

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-04-01 17:08:35 Re: [HACKERS] Re: [PORTS] Port Bug Report: int2 negative numbers not parsed correctly
Previous Message Jose' Soares Da Silva 1998-04-01 16:32:29 Re: [HACKERS] Re: [DOCS] Reference Manual