Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
53311358
Commit
53311358
authored
Dec 06, 1999
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rule deparser needs to quote identifiers that are spelled the same as
SQL keywords.
parent
7657bce7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/ruleutils.c
+19
-3
No files found.
src/backend/utils/adt/ruleutils.c
View file @
53311358
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* out of it's tuple
* out of it's tuple
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.3
3 1999/11/24 16:52:37 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.3
4 1999/12/06 02:37:17 tgl
Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
#include "lib/stringinfo.h"
#include "lib/stringinfo.h"
#include "optimizer/clauses.h"
#include "optimizer/clauses.h"
#include "optimizer/tlist.h"
#include "optimizer/tlist.h"
#include "parser/keywords.h"
#include "parser/parsetree.h"
#include "parser/parsetree.h"
#include "utils/builtins.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
...
@@ -1764,8 +1765,8 @@ quote_identifier(char *ident)
...
@@ -1764,8 +1765,8 @@ quote_identifier(char *ident)
{
{
/*
/*
* Can avoid quoting if ident starts with a lowercase letter and
* Can avoid quoting if ident starts with a lowercase letter and
* contains only lowercase letters, digits, and underscores
.
* contains only lowercase letters, digits, and underscores
,
* Otherwise, supply quotes.
*
*and* is not any SQL keyword.
Otherwise, supply quotes.
*/
*/
bool
safe
;
bool
safe
;
char
*
result
;
char
*
result
;
...
@@ -1791,6 +1792,21 @@ quote_identifier(char *ident)
...
@@ -1791,6 +1792,21 @@ quote_identifier(char *ident)
}
}
}
}
if
(
safe
)
{
/*
* Check for keyword. This test is overly strong, since many of
* the "keywords" known to the parser are usable as column names,
* but the parser doesn't provide any easy way to test for whether
* an identifier is safe or not... so be safe not sorry.
*
* Note: ScanKeywordLookup() expects an all-lower-case input, but
* we've already checked we have that.
*/
if
(
ScanKeywordLookup
(
ident
)
!=
NULL
)
safe
=
false
;
}
if
(
safe
)
if
(
safe
)
return
ident
;
/* no change needed */
return
ident
;
/* no change needed */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment