Re: [INTERFACES] Re: [HACKERS] changes in 6.4

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Hannu Krosing <hannu(at)trust(dot)ee>
Cc: Vadim Mikheev <vadim(at)krs(dot)ru>, hackers(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Re: [HACKERS] changes in 6.4
Date: 1998-07-16 13:36:01
Message-ID: 35AE01C1.DFC343BA@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-interfaces

> > TRIM is keyword, not a function...
> > We have to copy some lines in gram.y
> Wow! is this standard ?
> I found the function trim by doing 'select oprname from pg_oper'
> and tested it as follows:
>
> hannu=> select trim(' x ');
> btrim
> -----
> x
> (1 row)
> why is the column called btrim ?
> some rewrite magic in parser ?
> If it must stay a keyword, then perhaps we should remove the proc ?

Uh, yes, I think you are right. Here's why:

The SQL92 syntax for the trim() function is as follows:

TRIM([LEADING|TRAILING|BOTH] [char FROM] string)

This syntax is _not_ the clean "function(arg1,arg2,...)" syntax that the
parser could handle without change, so I had to make TRIM a keyword in
the parser and explicitly decode the possible argument phrases.

To implement all possibilities, I transform the function in the parser
to the functions btrim(), rtrim(), and ltrim() implemented earlier by
Edmund Mergl as the "Oracle compatibility functions".

I'll add TRIM() and the other goofy pseudo-functions to the CHECK
syntax, and take the trim(arg1) declaration out of pg_proc since it can
never get executed.

Oh, btw we allow trimming strings from strings, not just trimming chars
from strings :)

- Tom

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-07-16 13:49:27 Re: [INTERFACES] Re: [HACKERS] changes in 6.4
Previous Message Hannu Krosing 1998-07-16 10:56:40 Re: [INTERFACES] Re: [HACKERS] changes in 6.4

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-07-16 13:49:27 Re: [INTERFACES] Re: [HACKERS] changes in 6.4
Previous Message Hannu Krosing 1998-07-16 10:56:40 Re: [INTERFACES] Re: [HACKERS] changes in 6.4

Browse pgsql-interfaces by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-07-16 13:41:00 Re: [INTERFACES] ecpg SQL-return codes?
Previous Message Telephone VdB Foods Ltd 1998-07-16 12:58:58 RE: [ INTERFACES ] What technology ????