On Wed, Apr 28, 2004 at 12:30:06PM -0400, Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > David Fetter wrote:
> > > Kind people,
> > >
> > > Please find attached a diff to the SGML docs that attempts to go over
> > > the new dollar quoting feature.
> > 
> > I think we should just use $$ in each case.  Otherwise it might look 
> > more complicated than before.
> 
> Agreed.  I was worried about dollar arguments in functions, e.g. $1:
>       
>       test=> select $$$1$$;
>        ?column?
>       ----------
>        $1
>       (1 row)
> 
> but that seems to be OK.  Is our only problem actual $$ in a
> function body?

This is a design feature, as I understand it.

> And there is no way of escaping that, right?

Right.

> They have to choose a different quote characters sequence.

Yes.  Here is a short, but (IMHO) useful example.  Incidentally, I
have not yet found a way to get it working in versions prior to CVS
HEAD.

CREATE OR REPLACE FUNCTION has_bad_chars(TEXT) RETURNS BOOLEAN AS
$function$
BEGIN
    RETURN ($1 ~ $q$[\t\r\n\v|\\]$q$);
END;
$function$ LANGUAGE plpgsql;

Cheers,
D
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to