Re: massive quotes?

From: Tilo Schwarz <mail(at)tilo-schwarz(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jon Jensen <jon(at)endpoint(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: massive quotes?
Date: 2003-09-11 22:03:36
Message-ID: 200309120003.37027.mail@tilo-schwarz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian writes:
> Tom Lane wrote:
> > Jon Jensen <jon(at)endpoint(dot)com> writes:
> > > Is there a reason not to use here documents?
> >
> > The $$FOO proposal I put forward earlier was consciously modeled on
> > here-documents. We cannot use exactly the shell syntax for
> > here-documents, though, mainly because we already have meaning assigned
> > to strings like <<' (<< is already a standard operator, and the ' could
> > be the start of an ordinary literal).
> >
> > I would definitely like to see us adopt a proposal that is like
> > here-documents to the extent that there's a family of possible
> > terminator markers and not only one. But we'll have to adjust the
> > syntax a little bit. If you don't like $$FOO, what else comes to mind?
>
> Couldn't we allow << at the beginning of the line to mean 'here' document?

What about the Python approach: The literal text is enclosed either in a pair
of three single quotes or three double quotes. So you can do (e.g. in the
python shell)

> s = """
This is
'one'
string.
"""

to set string s or

> s = '''
This is
'one'
string.
'''

Even

> s = """
This is 'one'
string with '''triple single quotes'''
and some "double" quotes.
"""
works:

> print s

This is 'one'
string with '''triple single quotes'''
and some "double" quotes.

Bye,

Tilo

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2003-09-11 22:19:31 Re: Another small bug (pg_autovacuum)
Previous Message Jon Jensen 2003-09-11 22:00:15 Re: massive quotes?