Re: dollar quoting - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: dollar quoting
Date
Msg-id 4025378F.9010307@dunslane.net
Whole thread Raw
In response to Re: dollar quoting  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: dollar quoting  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Andrew Dunstan wrote:

>
>
> Tom Lane wrote:
>
>>
>> I kinda thought you had volunteered to work on the psql part...
>>
>>  
>>
>
>
> I don't recall being that specific, but you could be right. In any 
> case, I didn't want to trip over anyone else, which is why I asked.
>
> I will try to coordinate with Jon.
>

After staring at the code for a long time, I think I see how to do this. 
It's complicated a bit by the fact that $ is a valid identifier 
character. So my current thinking is to say that if we see $ not in a 
quote and not preceded by a valid identifier char then it is the start 
of a $foo$ sequence. Or have I missed something? Can we validly see $ in 
any other context?

BTW, Tom's proof of concept patch worked just fine for me. I changed the 
allowed pattern to what I think was agreed:

dolqdelim   \$([A-Za-z\200-\377][A-Za-z\200-\377_0-9]*)?\$

and changed some names and comments to remove misleading references to 
"here docs".

cheers

andrew



pgsql-hackers by date:

Previous
From: "Alex J. Avriette"
Date:
Subject: RFC: Very large scale postgres support
Next
From: Diego Montenegro
Date:
Subject: Backend Code