Re: [PATCHES] [HACKERS] dollar quoting

2004-05-12 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Comments welcome. Reviewers: I am not sure I got multi-byte stuff right > in psql/mainloop.c - please pay close attention to that. The i-1 stuff should generally be i-prevlen. Not sure if there are any other pitfalls. A bigger problem here: > +

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-16 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I am a little concerned about adding the overhead of lex to psql. Right > > now, some folks have reported that lex/yacc take a considerable amount > > of processing time in the backend as part of a query, and adding that to > > psql j

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-16 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > I am a little concerned about adding the overhead of lex to psql. Right > now, some folks have reported that lex/yacc take a considerable amount > of processing time in the backend as part of a query, and adding that to > psql just to do $$ seems questio

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-16 Thread Bruce Momjian
Tom Lane wrote: > Andrew Dunstan <[EMAIL PROTECTED]> writes: > >> No, it won't. The problem is that it should, because the backend will > >> see that as '42' followed by a $foo$ quote start. > > > Ok, I see what you are saying. This mismatch would only happen on > > invalid input, though. I beli

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-15 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: >> No, it won't. The problem is that it should, because the backend will >> see that as '42' followed by a $foo$ quote start. > Ok, I see what you are saying. This mismatch would only happen on > invalid input, though. I believe that what I did will wor

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-15 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: Tom Lane wrote: ... But how about 42$foo$ This is a syntax error in 7.4, and we propose to redefine it as an integer literal '42' followed by a dollar-quote start symbol. The test should not succeed anywhere in the stri

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-14 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> ... But how about >> 42$foo$ >> This is a syntax error in 7.4, and we propose to redefine it as an >> integer literal '42' followed by a dollar-quote start symbol. > The test should not succeed anywhere in the string '42$foo$'. No, i

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-14 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: I ended up not using a regex, which seemed to be a little heavy handed, but just writing a small custom recognition function, that should (and I think does) mimic the pattern recognition for these tokens used by the backend lexer.

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-14 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > I ended up not using a regex, which seemed to be a little heavy handed, > but just writing a small custom recognition function, that should (and I > think does) mimic the pattern recognition for these tokens used by the > backend lexer. I looked at t

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-09 Thread Andrew Dunstan
I think the attached patch addresses Tom's comments. I ended up not using a regex, which seemed to be a little heavy handed, but just writing a small custom recognition function, that should (and I think does) mimic the pattern recognition for these tokens used by the backend lexer. This patch

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-09 Thread Andrew Dunstan
Tom Lane wrote: A bigger problem here: + else if (!dol_quote && line[i] == '$' && + !isdigit(line[i + thislen]) && + (dol_end = strchr(line+i+1,'$')) != NULL && + (i == 0 || + ! ((line[i-1] &

Re: [PATCHES] [HACKERS] dollar quoting

2004-02-08 Thread Andrew Dunstan
Andrew Dunstan wrote: Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: 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