Re: massive quotes?
От | Tom Lane |
---|---|
Тема | Re: massive quotes? |
Дата | |
Msg-id | 5326.1063331924@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: massive quotes? (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: massive quotes?
|
Список | pgsql-hackers |
Bruce Momjian <pgman@candle.pha.pa.us> writes: > ... You are saying it is safer to > make it at the beginnning of a line _and_ have it be something that > isn't used in SQL, but $$ is used in Perl, so I don't see the big > advantage either way --- once you say X has to begin at the beginning of > the line, we are already making things breakable by a newline, no? Keep in mind that we have two different requirements: the quote start marker has to be recognizable while we are parsing SQL (or possibly plpgsql) code. The quote end marker has to be recognizable while we are scanning text that could be almost anything. The cute thing about the here-document solution to this problem is that you can choose the quote end marker on a case-by-case basis. So you can always pick something that won't conflict with anything that's actually in the text you need to quote. If we try to go with fixed markers (like {' ... }' and some other ideas that were floated today), then we lose that flexibility, and we're up against the losing game of trying to pick an end-marker that won't cause problems in any programming language anywhere (not to mention possible uses of the quoting mechanism for arbitrary string literals that aren't even function bodies). I'm not wedded to the "$$FOO" idea in particular, but I do think we want to go with a solution that allows a variable end-marker. regards, tom lane
В списке pgsql-hackers по дате отправления: