[DOCS] Substring undocumented form
Hi all,
Someone submitted a comment to the documentation which made mention of
the fact that while we provide one form of the 3-parameter substring
function, we don't mention an alternative one.
substring(string from pattern for escape)
can be written:
substring(string, pattern, escape)
Curiously, this doesn't appear to be the same with similar functions.
For instance, the following can't be changed in a similar way:
overlay('Tas' placing 'hom' from 2 for 4)
can't be written:
overlay('Tas', 'hom', 2, 4)
position('om' in 'Thomas')
can't be written:
position('om', 'Thomas')
So this doesn't look like a general alternative form. Is the
alternative form of substring deprecated or just missing from the
documentation?
Thanks
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Re: [DOCS] Substring undocumented form
On Sat, Sep 25, 2010 at 4:36 AM, Thom Brown wrote:
> Someone submitted a comment to the documentation which made mention of
> the fact that while we provide one form of the 3-parameter substring
> function, we don't mention an alternative one.
>
> substring(string from pattern for escape)
> can be written:
> substring(string, pattern, escape)
>
> Curiously, this doesn't appear to be the same with similar functions.
> For instance, the following can't be changed in a similar way:
>
> overlay('Tas' placing 'hom' from 2 for 4)
> can't be written:
> overlay('Tas', 'hom', 2, 4)
>
> position('om' in 'Thomas')
> can't be written:
> position('om', 'Thomas')
>
> So this doesn't look like a general alternative form. Is the
> alternative form of substring deprecated or just missing from the
> documentation?
You can call any of them with the normal function call syntax as
pg_catalog.fn_name(...). I think the reason why substring() works
anyway is because the substr_list nonterminal in gram.y includes a
production for expr_list. The overlay_list and position_list
nonterminals are not similarly equipped.
As to whether or not such alternative forms should be documented, I
could go either way.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Re: [DOCS] Inconsistent index links
On Wed, Sep 1, 2010 at 2:21 PM, Thom Brown wrote: > I noticed that all aggregate functions listed in the documentation > index direct to a page listing all the aggregate functions and their > usage, with the exception of count, max, min and sum, which direct to > the aggregate function tutorial page. From the index, these sections > are indistinguishable from one another since they share the same page > name. I'm wondering if one should be named differently, like > Aggregate Functions Tutorial. Yeah, maybe. The thing is, many of the things in the tutorial-sql chapter could be subject to similar confusion. Is there a way we can make those show up differently in the index than they do in the table of contents for that chapter? > Also, any particular reason why those 4 aggregate functions go to a > different place to all the others? This just seems wildly inconsistent. I'd be inclined to make these all point to the reference docs rather than the tutorial. Or else point to both. > The avg function is confusingly indexed only as "average", which > shouldn't really be a problem... unless someone types in "avg" into > their browser's find box. Maybe this should have "average" as a > primary term and "avg" as a secondary (with Pavel's 'median" function > to be added later). Sounds fine to me. > But next to this "average" index entry are links > to both the aggregate function sections, which are named identically. > I raised a similar issue to this for "privileges" in the index > previously. This should be made consistent with whatever we do about the point two paragraphs up. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company -- Sent via pgsql-docs mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs
