mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Support SQL99 embedded double-quote syntax for quoted identifiers.
Allow this in the parser and in pg_dump, but it is probably not enough for a complete solution. Better to have the feature started then never here.
This commit is contained in:
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.73 2000/07/14 15:43:32 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.74 2000/08/06 17:50:38 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -136,6 +136,7 @@ xqcat {quote}{whitespace_with_newline}{quote}
|
|||||||
dquote \"
|
dquote \"
|
||||||
xdstart {dquote}
|
xdstart {dquote}
|
||||||
xdstop {dquote}
|
xdstop {dquote}
|
||||||
|
xddouble {dquote}{dquote}
|
||||||
xdinside [^"]+
|
xdinside [^"]+
|
||||||
|
|
||||||
/* C-style comments
|
/* C-style comments
|
||||||
@ -351,6 +352,9 @@ other .
|
|||||||
yylval.str = pstrdup(literalbuf);
|
yylval.str = pstrdup(literalbuf);
|
||||||
return IDENT;
|
return IDENT;
|
||||||
}
|
}
|
||||||
|
<xd>{xddouble} {
|
||||||
|
addlit(yytext, yyleng-1);
|
||||||
|
}
|
||||||
<xd>{xdinside} {
|
<xd>{xdinside} {
|
||||||
addlit(yytext, yyleng);
|
addlit(yytext, yyleng);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.44 2000/07/04 14:25:27 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.45 2000/08/06 17:50:48 thomas Exp $
|
||||||
*
|
*
|
||||||
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
|
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
|
||||||
*
|
*
|
||||||
@ -517,8 +517,10 @@ fmtId(const char *rawid, bool force_quotes)
|
|||||||
|
|
||||||
if (!force_quotes)
|
if (!force_quotes)
|
||||||
{
|
{
|
||||||
|
/* do a quick check on the first character... */
|
||||||
if (!islower((int) *rawid))
|
if (!islower((int) *rawid))
|
||||||
force_quotes = true;
|
force_quotes = true;
|
||||||
|
/* otherwise check the entire string */
|
||||||
else
|
else
|
||||||
for (cp = rawid; *cp; cp++)
|
for (cp = rawid; *cp; cp++)
|
||||||
{
|
{
|
||||||
@ -541,8 +543,15 @@ fmtId(const char *rawid, bool force_quotes)
|
|||||||
appendPQExpBufferChar(id_return, '\"');
|
appendPQExpBufferChar(id_return, '\"');
|
||||||
for (cp = rawid; *cp; cp++)
|
for (cp = rawid; *cp; cp++)
|
||||||
{
|
{
|
||||||
|
/* Did we find a double-quote in the string?
|
||||||
|
* Then make this a double double-quote per SQL99.
|
||||||
|
* Before, we put in a backslash/double-quote pair.
|
||||||
|
* - thomas 2000-08-05 */
|
||||||
if (*cp == '\"')
|
if (*cp == '\"')
|
||||||
appendPQExpBufferChar(id_return, '\\');
|
{
|
||||||
|
appendPQExpBufferChar(id_return, '\"');
|
||||||
|
appendPQExpBufferChar(id_return, '\"');
|
||||||
|
}
|
||||||
appendPQExpBufferChar(id_return, *cp);
|
appendPQExpBufferChar(id_return, *cp);
|
||||||
}
|
}
|
||||||
appendPQExpBufferChar(id_return, '\"');
|
appendPQExpBufferChar(id_return, '\"');
|
||||||
|
Reference in New Issue
Block a user