Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3BD011337BA0 for ; Sat, 25 Sep 2010 10:40:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 56209-03 for ; Sat, 25 Sep 2010 13:40:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id 52AD21337B61 for ; Sat, 25 Sep 2010 10:40:08 -0300 (ADT) Received: by iwn5 with SMTP id 5so3213033iwn.19 for ; Sat, 25 Sep 2010 06:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pwrHTEB+LrvzMz+iCMxfaumRaP452J/ztqoxT8k+91A=; b=DW1BkYV3P//1mKwFBBNhLkXrrdu5exrLGREJQu1DK+xFgTLB7/2FuduLFk0SsBMMcN A5yEkj1MGmmSE03+baz/Y1MwFIqH0Wt6Yp89JqVSi1V5OK2BBG+ESvc1cyjP+QwxC+a4 g+dnrCOElaPyoAefEwayvJTaXXKMk+NJpHTdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=uI+vJcoBuueW009trhFOfD4sNBHLjMjbLs0SVcGURNtd6BjxWyNW+kCppi3jQtxmOC NbLdyahzO3GWOyOOiaOe1SJ8l56ayk1f57s6WPMxxc/WQeqv8YyAMHGYfMlc1Dx0Ta+V od88umwX/hMrLRmd9cOvEXH55m0t9JnP+hFaI= MIME-Version: 1.0 Received: by 10.231.35.8 with SMTP id n8mr5599916ibd.78.1285422008300; Sat, 25 Sep 2010 06:40:08 -0700 (PDT) Received: by 10.231.10.131 with HTTP; Sat, 25 Sep 2010 06:40:08 -0700 (PDT) In-Reply-To: References: Date: Sat, 25 Sep 2010 09:40:08 -0400 Message-ID: Subject: Re: Substring undocumented form From: Robert Haas To: Thom Brown Cc: pgsql-docs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201009/119 X-Sequence-Number: 6109 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('Txxxxas' placing 'hom' from 2 for 4) > can't be written: > overlay('Txxxxas', 'hom', 2, 4) > > position('om' in 'Thomas') > can't be written: > position('om', 'Thomas') > > So this doesn't look like a general alternative form. =A0Is 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. --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company