pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Jim Drummey <drumeng@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Substrings by Regular Expression
Date: Fri, 21 Nov 2003 02:13:40 -0500
Message-ID: <9968.1069398820@sss.pgh.pa.us> (raw)
In-Reply-To: <20031119124031.G91425@megazone.bigpanda.com>
References: <463bd40b.0311140902.27de95a5@posting.google.com>
	<20031119124031.G91425@megazone.bigpanda.com>

Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> On Fri, 14 Nov 2003, Jim Drummey wrote:
>> pds=>  select substring( str1 from ',' ) from address;
>> ERROR:  pg_atoi: error in ",": can't parse ","
>> 
>> Am I missing something?

> That functionality was added in 7.3 I believe.  You may wish
> to upgrade.

Also, it's worth noting that AFAICT the above is illegal per SQL99
--- the textual SUBSTRING variants the spec defines are

         <character substring function> ::=
              SUBSTRING <left paren> <character value expression> FROM <start position>
                          [ FOR <string length> ] <right paren>

         <regular expression substring function> ::=
              SUBSTRING <left paren> <character value expression> FROM
                          <character value expression> FOR
                          <escape character> <right paren>

so it looks to me like you can't omit "FOR <escape>" if you want to
adhere to the letter of the spec.  We do allow omitting that clause
as a pretty-obvious extension ... but it's important to realize that
it *is* an extension.

			regards, tom lane



view thread (3+ messages)

Message-ID: <9968.1069398820@sss.pgh.pa.us>
Permalink:  ../9968.1069398820@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9968.1069398820@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sszabo@megazone.bigpanda.com, drumeng@yahoo.com
  Subject: Re: Substrings by Regular Expression
  In-Reply-To: <9968.1069398820@sss.pgh.pa.us>

* 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