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
65537ac1
Commit
65537ac1
authored
Jun 02, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for \x hex escapes in backend strings. Octal was already
supported. This follows the C standard escapes.
parent
202e6e73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+13
-12
src/backend/parser/scan.l
src/backend/parser/scan.l
+7
-2
No files found.
doc/src/sgml/syntax.sgml
View file @
65537ac1
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.
99 2004/12/23 05:37:40 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.
100 2005/06/02 01:23:08 momjian
Exp $
-->
-->
<chapter id="sql-syntax">
<chapter id="sql-syntax">
...
@@ -254,17 +254,18 @@ UPDATE "my_table" SET "a" = 5;
...
@@ -254,17 +254,18 @@ UPDATE "my_table" SET "a" = 5;
<para>
<para>
Another <productname>PostgreSQL</productname> extension is that
Another <productname>PostgreSQL</productname> extension is that
C-style backslash escapes are available:
C-style backslash escapes are available: <literal>\b</literal> is a
<literal>\b</literal> is a backspace, <literal>\f</literal> is a
backspace, <literal>\f</literal> is a form feed,
form feed, <literal>\n</literal> is a newline,
<literal>\n</literal> is a newline, <literal>\r</literal> is a
<literal>\r</literal> is a carriage return, <literal>\t</literal>
carriage return, <literal>\t</literal> is a tab. Also supported is
is a tab, and <literal>\<replaceable>xxx</replaceable></literal>,
<literal>\<replaceable>digits</replaceable></literal>, where
where <replaceable>xxx</replaceable> is an octal number, is a
<replaceable>ddd</replaceable> represents an octal byte value, and
byte with the corresponding code. (It is your responsibility
<literal>\x<replaceable>hexdigits</replaceable></literal>, where
that the byte sequences you create are valid characters in the
<replaceable>hexdigits</replaceable> represents a hexadecimal byte value.
server character set encoding.) Any other character following a
(It is your responsibility that the byte sequences you create are
backslash is taken literally. Thus, to include a backslash in a
valid characters in the server character set encoding.) Any other
string constant, write two backslashes.
character following a backslash is taken literally. Thus, to
include a backslash in a string constant, write two backslashes.
</para>
</para>
<para>
<para>
...
...
src/backend/parser/scan.l
View file @
65537ac1
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.12
2 2005/05/26 01:24:29 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.12
3 2005/06/02 01:23:08 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -193,8 +193,9 @@ xnstart [nN]{quote}
...
@@ -193,8 +193,9 @@ xnstart [nN]{quote}
xqstart {quote}
xqstart {quote}
xqdouble {quote}{quote}
xqdouble {quote}{quote}
xqinside [^\\']+
xqinside [^\\']+
xqescape [\\][^0-7]
xqescape [\\][^0-7
x
]
xqoctesc [\\][0-7]{1,3}
xqoctesc [\\][0-7]{1,3}
xqhexesc [\\]x[0-9A-Fa-f]{1,2}
/* $foo$ style quotes ("dollar quoting")
/* $foo$ style quotes ("dollar quoting")
* The quoted string starts with $foo$ where "foo" is an optional string
* The quoted string starts with $foo$ where "foo" is an optional string
...
@@ -435,6 +436,10 @@ other .
...
@@ -435,6 +436,10 @@ other .
unsigned char c = strtoul(yytext+1, NULL, 8);
unsigned char c = strtoul(yytext+1, NULL, 8);
addlitchar(c);
addlitchar(c);
}
}
<xq>{xqhexesc} {
unsigned char c = strtoul(yytext+2, NULL, 16);
addlitchar(c);
}
<xq>{quotecontinue} {
<xq>{quotecontinue} {
/* ignore */
/* ignore */
}
}
...
...
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