Re: patch adding new regexp functions

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: patch adding new regexp functions
Дата
Msg-id 20070215170258.GA3282@fetter.org
обсуждение исходный текст
Ответ на Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: patch adding new regexp functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
On Thu, Feb 15, 2007 at 10:37:26AM -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.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@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!

В списке pgsql-patches по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: patch adding new regexp functions
Следующее
От: David Fetter
Дата:
Сообщение: Re: patch adding new regexp functions