Re: [BUGS] BUG #8335: trim() un-document behaviour

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: amutu(at)amutu(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #8335: trim() un-document behaviour
Date: 2013-08-12 18:18:01
Message-ID: 22386.1376331481@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I wrote:
> This will break even more stuff than the last patch, ie, every single
> stored rule or view that contains a TRIM function. You can *not*
> eliminate, or mess with, the expr_list production, because that's what
> dumping of these function calls relies on.

No, wait, I take that back. I was thinking that the function call would
dump out as trim(x, y) but actually none of the underlying functions
are named just "trim"; they're btrim, ltrim, or rtrim. So actually the
dump/reload scenario does not have anything to do with the trim_list
production --- the underlying functions just parse normally in any case.

The question remains why it's a good idea to mess with a syntax behavior
that's been like that for a dozen years or more. I don't see any upside
to doing that. As an example of a downside, right now if you try to
pass extra arguments to TRIM() you'll get

regression=# select trim(1,2,3);
ERROR: function pg_catalog.btrim(integer, integer, integer) does not exist
LINE 1: select trim(1,2,3);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

You might wonder why the message mentions "btrim" not "trim", but at least
the complaint is reasonably on-topic. After this patch, you'd just get
a "syntax error" message, which doesn't seem helpful at all.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2013-08-12 19:33:47 Re: [PATCH] Re: [BUGS] BUG #7815: Upgrading PostgreSQL from 9.1 to 9.2 with pg_upgrade/postgreql-setup fails - invalid status retrieve
Previous Message Tom Lane 2013-08-12 17:55:08 Re: [BUGS] BUG #8335: trim() un-document behaviour

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2013-08-12 18:22:25 Re: pg_basebackup vs. Windows and tablespaces
Previous Message Andrew Dunstan 2013-08-12 18:14:48 Re: pg_basebackup vs. Windows and tablespaces