Re: (b)trim anomalies

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Thomas F(dot)O'Connell" <tfo(at)sitening(dot)com>
Cc: PgSql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: (b)trim anomalies
Date: 2004-11-28 03:23:33
Message-ID: 200411280323.iAS3NXW09724@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas F.O'Connell wrote:
> I was just wondering why the btrim syntax that takes only a single
> argument is not documented in 9.4 in the documentation (I checked both
> 7.4 and 8.0 docs).
>
> This is in a 7.4.5 installation:
>
> pg=# \df btrim
> List of functions
> Result data type | Schema | Name | Argument data types
> ------------------+------------+-------+---------------------
> bytea | pg_catalog | btrim | bytea, bytea
> text | pg_catalog | btrim | text
> text | pg_catalog | btrim | text, text
> (3 rows)
>
> Is it ever documented anywhere that the single-argument version of
> btrim can be used to remove whitespace from the left and right of a
> given string? Is this version not supposed to be user-facing for some
> reason?
>
> Also, in this post:
>
> http://archives.postgresql.org/pgsql-sql/2002-01/msg00053.php
>
> Bruce sort of explains that TRIM is an ANSI word but doesn't fully
> explain why it doesn't show up in a \df listing:
>
> pg=# \df trim
> List of functions
> Result data type | Schema | Name | Argument data types
> ------------------+--------+------+---------------------
> (0 rows)
>
> This one's more a curiosity thing.

Because TRIM is an ANSI standard, we document TRIM (BOTH, ...) but not
btrim. The parser does the translation:

| TRIM '(' BOTH trim_list ')'
{
/* various trim expressions are defined in SQL92
* - thomas 1997-07-19
*/
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("btrim");
n->args = $4;
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;

Does that answer your questions?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message songsubosongtebo songsubosongtebo 2004-11-28 03:54:09 Re: GENERAL] Boolean error
Previous Message songsubosongtebo songsubosongtebo 2004-11-28 03:17:59 PQoidValue have no use?