pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas G. Lockhart <lockhart@alumni.caltech.edu>
To: Hannu Krosing <hannu@trust.ee>
Cc: Vadim Mikheev <vadim@krs.ru>
Cc: hackers@postgreSQL.org
Subject: Re: [INTERFACES] Re: [HACKERS] changes in 6.4
Date: Thu, 16 Jul 1998 13:36:01 +0000
Message-ID: <35AE01C1.DFC343BA@alumni.caltech.edu> (raw)
References: <199807141537.LAA24391@candle.pha.pa.us>
	<35AD0879.2EA15E8B@trust.ee>
	<35AD1048.97441728@krs.ru>
	<35ADBA13.753CDE3E@trust.ee>
	<35ADBF17.8FA3ABE0@krs.ru>
	<35ADDC68.F13FACB0@trust.ee>

> > 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



view thread (29+ messages)  latest in thread

Message-ID: <35AE01C1.DFC343BA@alumni.caltech.edu>
Permalink:  ../35AE01C1.DFC343BA@alumni.caltech.edu/
Also on:    postgresql.org/message-id/35AE01C1.DFC343BA@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: lockhart@alumni.caltech.edu, hannu@trust.ee, vadim@krs.ru, hackers@postgreSQL.org
  Subject: Re: [INTERFACES] Re: [HACKERS] changes in 6.4
  In-Reply-To: <35AE01C1.DFC343BA@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox