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
0fec77ae
Commit
0fec77ae
authored
Oct 27, 2008
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL:2008 syntax CURRENT_CATALOG, CURRENT_SCHEMA, SET CATALOG, SET SCHEMA.
parent
b1eeeb20
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
16 deletions
+97
-16
doc/src/sgml/func.sgml
doc/src/sgml/func.sgml
+20
-6
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/set.sgml
+12
-1
src/backend/catalog/sql_features.txt
src/backend/catalog/sql_features.txt
+2
-2
src/backend/parser/gram.y
src/backend/parser/gram.y
+45
-3
src/backend/parser/keywords.c
src/backend/parser/keywords.c
+4
-1
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+14
-3
No files found.
doc/src/sgml/func.sgml
View file @
0fec77ae
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.45
0 2008/10/14 17:12:32 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.45
1 2008/10/27 09:37:46 petere
Exp $ -->
<chapter
id=
"functions"
>
<title>
Functions and Operators
</title>
...
...
@@ -3184,7 +3184,8 @@ cast(-44 as bit(12)) <lineannotation>111111010100</lineannotation>
function fails and returns null. To indicate the part of the
pattern that should be returned on success, the pattern must contain
two occurrences of the escape character followed by a double quote
(
<literal>
"
</>
). The text matching the portion of the pattern
(
<literal>
"
</>
).
<!-- " font-lock sanity -->
The text matching the portion of the pattern
between these markers is returned.
</para>
...
...
@@ -10932,6 +10933,12 @@ postgres=# select * from unnest2(array[[1,2],[3,4]]);
</thead>
<tbody>
<row>
<entry><literal><function>
current_catalog
</function></literal></entry>
<entry><type>
name
</type></entry>
<entry>
name of current database (called
<quote>
catalog
</quote>
in the SQL standard)
</entry>
</row>
<row>
<entry><literal><function>
current_database
</function>
()
</literal></entry>
<entry><type>
name
</type></entry>
...
...
@@ -10939,7 +10946,7 @@ postgres=# select * from unnest2(array[[1,2],[3,4]]);
</row>
<row>
<entry><literal><function>
current_schema
</function>
()
</literal></entry>
<entry><literal><function>
current_schema
</function>
[()]
</literal></entry>
<entry><type>
name
</type></entry>
<entry>
name of current schema
</entry>
</row>
...
...
@@ -11055,6 +11062,10 @@ postgres=# select * from unnest2(array[[1,2],[3,4]]);
<secondary>
current
</secondary>
</indexterm>
<indexterm>
<primary>
current_catalog
</primary>
</indexterm>
<indexterm>
<primary>
current_database
</primary>
</indexterm>
...
...
@@ -11083,9 +11094,12 @@ postgres=# select * from unnest2(array[[1,2],[3,4]]);
<note>
<para>
<function>
current_user
</function>
,
<function>
session_user
</function>
, and
<function>
user
</function>
have special syntactic status in
<acronym>
SQL
</acronym>
:
they must be called without trailing parentheses.
<function>
current_catalog
</function>
,
<function>
current_schema
</function>
,
<function>
current_user
</function>
,
<function>
session_user
</function>
,
and
<function>
user
</function>
have special syntactic status
in
<acronym>
SQL
</acronym>
: they must be called without trailing
parentheses (optional in PostgreSQL in the case
of
<function>
current_schema
</function>
).
</para>
</note>
...
...
doc/src/sgml/ref/set.sgml
View file @
0fec77ae
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/set.sgml,v 1.9
2 2008/03/10 12:39:22 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/set.sgml,v 1.9
3 2008/10/27 09:37:47 petere
Exp $
PostgreSQL documentation
-->
...
...
@@ -150,6 +150,17 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep
special syntax:
<variablelist>
<varlistentry>
<term><literal>SCHEMA</literal></term>
<listitem>
<para>
<literal>SET SCHEMA '<replaceable>value</>'</> is an alias for
<literal>SET search_path TO <replaceable>value</></>. Only one
schema can be specified using this syntax.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>NAMES</literal></term>
<listitem>
...
...
src/backend/catalog/sql_features.txt
View file @
0fec77ae
...
...
@@ -295,8 +295,8 @@ F731 INSERT column privileges NO
F741 Referential MATCH types NO no partial match yet
F751 View CHECK enhancements NO
F761 Session management YES
F762 CURRENT_CATALOG
NO same as current_database()
F763 CURRENT_SCHEMA
NO same as current_schema()
F762 CURRENT_CATALOG
YES
F763 CURRENT_SCHEMA
YES
F771 Connection management YES
F781 Self-referencing operations YES
F791 Insensitive cursors YES
...
...
src/backend/parser/gram.y
View file @
0fec77ae
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.6
29 2008/10/27 08:47:14
petere Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.6
30 2008/10/27 09:37:47
petere Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -401,12 +401,13 @@ static TypeName *TableFuncTypeName(List *columns);
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
BOOLEAN_P BOTH BY
CACHE CALLED CASCADE CASCADED CASE CAST CHAIN CHAR_P
CACHE CALLED CASCADE CASCADED CASE CAST C
ATALOG_P C
HAIN CHAR_P
CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT
COMMITTED CONCURRENTLY CONFIGURATION CONNECTION CONSTRAINT CONSTRAINTS
CONTENT_P CONTINUE_P CONVERSION_P COPY COST CREATE CREATEDB
CREATEROLE CREATEUSER CROSS CSV CTYPE CURRENT_P CURRENT_DATE CURRENT_ROLE
CREATEROLE CREATEUSER CROSS CSV CTYPE CURRENT_P
CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
...
...
@@ -1133,6 +1134,22 @@ set_rest: /* Generic SET syntaxes: */
n->args = $5;
$$ = n;
}
| CATALOG_P Sconst
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("current database cannot be changed"),
scanner_errposition(@2)));
$$ = NULL; /*not reached*/
}
| SCHEMA Sconst
{
VariableSetStmt *n = makeNode(VariableSetStmt);
n->kind = VAR_SET_VALUE;
n->name = "search_path";
n->args = list_make1(makeStringConst($2, @2));
$$ = n;
}
| NAMES opt_encoding
{
VariableSetStmt *n = makeNode(VariableSetStmt);
...
...
@@ -8401,6 +8418,28 @@ func_expr: func_name '(' ')'
n->location = @1;
$$ = (Node *)n;
}
| CURRENT_CATALOG
{
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("current_database");
n->args = NIL;
n->agg_star = FALSE;
n->agg_distinct = FALSE;
n->func_variadic = FALSE;
n->location = @1;
$$ = (Node *)n;
}
| CURRENT_SCHEMA
{
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("current_schema");
n->args = NIL;
n->agg_star = FALSE;
n->agg_distinct = FALSE;
n->func_variadic = FALSE;
n->location = @1;
$$ = (Node *)n;
}
| CAST '(' a_expr AS Typename ')'
{ $$ = makeTypeCast($3, $5, @1); }
| EXTRACT '(' extract_list ')'
...
...
@@ -9336,6 +9375,7 @@ unreserved_keyword:
| CALLED
| CASCADE
| CASCADED
| CATALOG_P
| CHAIN
| CHARACTERISTICS
| CHECKPOINT
...
...
@@ -9625,6 +9665,7 @@ type_func_name_keyword:
| BETWEEN
| BINARY
| CROSS
| CURRENT_SCHEMA
| FREEZE
| FULL
| ILIKE
...
...
@@ -9667,6 +9708,7 @@ reserved_keyword:
| COLUMN
| CONSTRAINT
| CREATE
| CURRENT_CATALOG
| CURRENT_DATE
| CURRENT_ROLE
| CURRENT_TIME
...
...
src/backend/parser/keywords.c
View file @
0fec77ae
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.20
4 2008/10/22 11:00:34
petere Exp $
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.20
5 2008/10/27 09:37:47
petere Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -83,6 +83,7 @@ const ScanKeyword ScanKeywords[] = {
{
"cascaded"
,
CASCADED
,
UNRESERVED_KEYWORD
},
{
"case"
,
CASE
,
RESERVED_KEYWORD
},
{
"cast"
,
CAST
,
RESERVED_KEYWORD
},
{
"catalog"
,
CATALOG_P
,
UNRESERVED_KEYWORD
},
{
"chain"
,
CHAIN
,
UNRESERVED_KEYWORD
},
{
"char"
,
CHAR_P
,
COL_NAME_KEYWORD
},
{
"character"
,
CHARACTER
,
COL_NAME_KEYWORD
},
...
...
@@ -116,8 +117,10 @@ const ScanKeyword ScanKeywords[] = {
{
"csv"
,
CSV
,
UNRESERVED_KEYWORD
},
{
"ctype"
,
CTYPE
,
UNRESERVED_KEYWORD
},
{
"current"
,
CURRENT_P
,
UNRESERVED_KEYWORD
},
{
"current_catalog"
,
CURRENT_CATALOG
,
RESERVED_KEYWORD
},
{
"current_date"
,
CURRENT_DATE
,
RESERVED_KEYWORD
},
{
"current_role"
,
CURRENT_ROLE
,
RESERVED_KEYWORD
},
{
"current_schema"
,
CURRENT_SCHEMA
,
TYPE_FUNC_NAME_KEYWORD
},
{
"current_time"
,
CURRENT_TIME
,
RESERVED_KEYWORD
},
{
"current_timestamp"
,
CURRENT_TIMESTAMP
,
RESERVED_KEYWORD
},
{
"current_user"
,
CURRENT_USER
,
RESERVED_KEYWORD
},
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
0fec77ae
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.37
7 2008/10/21 08:38:16
petere Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.37
8 2008/10/27 09:37:47
petere Exp $ */
/* Copyright comment */
%{
...
...
@@ -423,12 +423,13 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
BOOLEAN_P BOTH BY
CACHE CALLED CASCADE CASCADED CASE CAST CHAIN CHAR_P
CACHE CALLED CASCADE CASCADED CASE CAST C
ATALOG_P C
HAIN CHAR_P
CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT
COMMITTED CONCURRENTLY CONFIGURATION CONNECTION CONSTRAINT CONSTRAINTS
CONTENT_P CONTINUE_P CONVERSION_P COPY COST CREATE CREATEDB
CREATEROLE CREATEUSER CROSS CSV CTYPE CURRENT_P CURRENT_DATE CURRENT_ROLE
CREATEROLE CREATEUSER CROSS CSV CTYPE CURRENT_P
CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
...
...
@@ -1217,6 +1218,10 @@ set_rest: /* Generic SET syntaxes: */
{ $$ = cat2_str(make_str("transaction"), $2); }
| SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
{ $$ = cat2_str(make_str("session characteristics as transaction"), $5); }
| CATALOG_P Sconst
{ $$ = cat2_str(make_str("catalog"), $2); }
| SCHEMA Sconst
{ $$ = cat2_str(make_str("schema"), $2); }
| NAMES opt_encoding
{ $$ = cat2_str(make_str("names"), $2); }
| ROLE ColId_or_Sconst
...
...
@@ -4469,6 +4474,10 @@ func_expr: func_name '(' ')'
{ $$ = make_str("session_user"); }
| USER
{ $$ = make_str("user"); }
| CURRENT_CATALOG
{ $$ = make_str("current_catalog"); }
| CURRENT_SCHEMA
{ $$ = make_str("current_schema"); }
| CAST '(' a_expr AS Typename ')'
{ $$ = cat_str(5, make_str("cast("), $3, make_str("as"), $5, make_str(")")); }
| EXTRACT '(' extract_list ')'
...
...
@@ -6867,10 +6876,12 @@ reserved_keyword:
| CONSTRAINT { $$ = make_str("constraint"); }
| CREATE { $$ = make_str("create"); }
| CURRENT_P { $$ = make_str("current"); }
| CURRENT_CATALOG { $$ = make_str("current_catalog"); }
| CURRENT_DATE { $$ = make_str("current_date"); }
| CURRENT_TIME { $$ = make_str("current_time"); }
| CURRENT_TIMESTAMP { $$ = make_str("current_timestamp"); }
| CURRENT_ROLE { $$ = make_str("current_role"); }
| CURRENT_SCHEMA { $$ = make_str("current_schema"); }
| CURRENT_USER { $$ = make_str("current_user"); }
| DEFAULT { $$ = make_str("default"); }
| DEFERRABLE { $$ = make_str("deferrable"); }
...
...
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