Re: patch adding new regexp functions

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Jeremy Drake <pgsql(at)jdrake(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, Neil Conway <neilc(at)samurai(dot)com>
Subject: Re: patch adding new regexp functions
Date: 2007-02-15 17:02:58
Message-ID: 20070215170258.GA3282@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, Feb 15, 2007 at 10:37:26AM -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > so that you would have the position for each match, automatically. Is
> > this information available in the regex code?
>
> Certainly, that's where we got the text snippets from to begin with.
> However, I'm not sure that this is important enough to justify a
> special type --- for one thing, since we don't have arrays of
> composites,

This is a TODO :)

I've obviously misunderstood the scope of the TODO because it appears
that an INSERT into pg_type at creation time for compound types that
looks something like the below would do it. What have I missed?

INSERT INTO pg_type
VALUES (
'_foo', /* Generated by makeArrayTypeName */
16744, /* OID of schema */
10, /* OID of owner of the base type */
-1, /* typlen indicates varlena */
'f', /* not passed by value */
'c', /* typtype is composite */
't', /* type is already defined */
',', /* typdelim */
0, /* should this actually refer to the type? */
'foo'::regtype, /* typelem */
'array_in', /* typinput */
'array_out', /* typoutput */
'array_recv', /* typreceive */
'array_send', /* typsend */
0, /* typanalyze */
'i', /* typalign. Should this be 'd'? */
'x', /* typstorage */
'f', /* not a DOMAIN, but while we're at it, why not arrays of DOMAIN? */
0, /* base type. should this be different? */
-1, /* no typmod */
0 /* dims not specified */
);

> that would foreclose responding to Peter's concern that SETOF is the
> wrong thing. If you look at the Perl and Tcl APIs for regexes, they
> return just the strings, not the numerical positions; and I've not
> heard anyone complaining about that.

They do return them in the order in which they appear, though, which,
as far as I can tell, Jeremy's functions also do.

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-02-15 17:23:21 Re: Plan for compressed varlena headers
Previous Message Hiroshi Saito 2007-02-15 17:00:48 Re: pg_restore fails with a custom backup file

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2007-02-15 20:10:56 Re: patch adding new regexp functions
Previous Message Peter Eisentraut 2007-02-15 16:57:09 Re: patch adding new regexp functions