diff --git a/doc/src/sgml/features.sgml b/doc/src/sgml/features.sgml
new file mode 100644
index 0000000000..f69c4c3b5f
--- /dev/null
+++ b/doc/src/sgml/features.sgml
@@ -0,0 +1,1811 @@
+
+
+
+ SQL99 Feature List
+
+
+ Supported Features
+
+
+ SQL92 defined three feature sets for
+ compliance: basic, intermediate, and advanced. Most database
+ products claiming SQL standards compliance were
+ compliant at only the basic level, since the entire set of
+ intermediate and advanced features was either to voluminous or in
+ conflict with legacy behaviors.
+
+
+
+ SQL99 defines a large set of individual
+ features rather than the ineffectively broad three levels found in
+ SQL92. We list the entire set of features
+ defined in the standard, with comments on those features not yet
+ implemented in PostgreSQL.
+
+
+
+
+
+ Identifier
+ Description
+ Comment
+
+
+
+
+ E011
+ Numeric data types
+
+
+
+ E011-01
+ INTEGER and SMALLINT data types
+
+
+
+ E011-02
+ REAL, DOUBLE PRECISON, and FLOAT data types
+
+
+
+ E011-03
+ DECIMAL and NUMERIC data types
+
+
+
+ E011-04
+ Arithmetic operators
+
+
+
+ E011-05
+ Numeric comparison
+
+
+
+ E011-06
+ Implicit casting among the numeric data types
+
+
+
+ E021
+ Character data types
+
+
+
+ E021-01
+ CHARACTER data type
+
+
+
+ E021-02
+ CHARACTER VARYING data type
+
+
+
+ E021-03
+ Character literals
+
+
+
+ E021-04
+ CHARACTER_LENGTH function
+
+
+
+ E021-05
+ OCTET_LENGTH function
+
+
+
+ E021-06
+ SUBSTRING function
+
+
+
+ E021-07
+ Character concatenation
+
+
+
+ E021-08
+ UPPER and LOWER functions
+
+
+
+ E021-09
+ TRIM function
+
+
+
+ E021-10
+ Implicit casting among the character data types
+
+
+
+ E021-11
+ POSITION function
+
+
+
+ E011-12
+ Character comparison
+
+
+
+ E031
+ Identifiers
+
+
+
+ E031-01
+ Delimited identifiers
+
+
+
+ E031-02
+ Lower case identifiers
+
+
+
+ E031-03
+ Trailing underscore
+
+
+
+ E051
+ Basic query specification
+
+
+
+ E051-01
+ SELECT DISTINCT
+
+
+
+ E051-02
+ GROUP BY clause
+
+
+
+ E051-04
+ GROUP BY can contain columns not in <select list>
+
+
+
+ E051-05
+ Select list items can be renamed
+
+
+
+ E051-06
+ HAVING clause
+
+
+
+ E051-07
+ Qualified * in select list
+
+
+
+ E051-08
+ Correlation names in the FROM clause
+
+
+
+ E051-09
+ Rename columns in the FROM clause
+
+
+
+ E061
+ Basic predicates and search conditions
+
+
+
+ E061-01
+ Comparison predicate
+
+
+
+ E061-02
+ BETWEEN predicate
+
+
+
+ E061-03
+ IN predicate with list of values
+
+
+
+ E061-04
+ LIKE predicate
+
+
+
+ E061-05
+ LIKE predicate ESCAPE clause
+
+
+
+ E061-06
+ NULL predicate
+
+
+
+ E061-07
+ Quantified comparison predicate
+
+
+
+ E061-08
+ EXISTS predicate
+
+
+
+ E061-09
+ Subqueries in comparison predicate
+
+
+
+ E061-11
+ Subqueries in IN predicate
+
+
+
+ E061-12
+ Subqueries in quantified comparison predicate
+
+
+
+ E061-13
+ Correlated subqueries
+
+
+
+ E061-14
+ Search condition
+
+
+
+ E071
+ Basic query expressions
+
+
+
+ E071-01
+ UNION DISTINCT table operator
+
+
+
+ E071-02
+ UNION ALL table operator
+
+
+
+ E071-03
+ EXCEPT DISTINCT table operator
+
+
+
+ E071-05
+ Columns combined via table operators need not have
+ exactly the same data type
+
+
+
+ E071-06
+ Table operators in subqueries
+
+
+
+ E081
+ Basic Privileges
+
+
+
+ E081-01
+ SELECT privilege
+
+
+
+ E081-02
+ DELETE privilege
+
+
+
+ E081-03
+ INSERT privilege at the table level
+
+
+
+ E081-04
+ UPDATE privilege at the table level
+
+
+
+ E081-05
+ UPDATE privilege at the column level
+
+
+
+ E081-06
+ REFERENCES privilege at the table level
+
+
+
+ E081-07
+ REFERENCES privilege at the column level
+
+
+
+ E081-08
+ WITH GRANT OPTION
+
+
+
+ E091
+ Set functions
+
+
+
+ E091-01
+ AVG
+
+
+
+ E091-02
+ COUNT
+
+
+
+ E091-03
+ MAX
+
+
+
+ E091-04
+ MIN
+
+
+
+ E091-05
+ SUM
+
+
+
+ E091-06
+ ALL quantifier
+
+
+
+ E091-07
+ DISTINCT quantifier
+
+
+
+ E101
+ Basic data manipulation
+
+
+
+ E101-01
+ INSERT statement
+
+
+
+ E101-03
+ Searched UPDATE statement
+
+
+
+ E101-04
+ Searched DELETE statement
+
+
+
+ E111
+ Single row SELECT statement
+
+
+
+ E121
+ Basic cursor support
+
+
+
+ E121-01
+ DECLARE CURSOR
+
+
+
+ E121-02
+ ORDER BY columns need not be in select list
+
+
+
+ E121-03
+ Value expressions in ORDER BY clause
+
+
+
+ E121-04
+ OPEN statement
+
+
+
+ E121-06
+ Positioned UPDATE statement
+
+
+
+ E121-07
+ Positioned DELETE statement
+
+
+
+ E121-08
+ CLOSE statement
+
+
+
+ E121-10
+ FETCH statement implicit NEXT
+
+
+
+ E121-17
+ WITH HOLD cursors
+
+
+
+ E131
+ Null value support (nulls in lieu of values)
+
+
+
+ E141
+ Basic integrity constraints
+
+
+
+ E141-01
+ NOT NULL constraints
+
+
+
+ E141-02
+ UNIQUE constraints of NOT NULL columns
+
+
+
+ E141-03
+ PRIMARY KEY constraints
+
+
+
+ E141-04
+ Basic FOREIGN KEY constraint with the NO ACTION default
+ for both referential delete action and referential update
+ action
+
+
+
+ E141-06
+ CHECK constraints
+
+
+
+ E141-07
+ Column defaults
+
+
+
+ E141-08
+ NOT NULL inferred on PRIMARY KEY
+
+
+
+ E141-10
+ Names in a foreign key can be specified in any order
+
+
+
+ E151
+ Transaction support
+
+
+
+ E151-01
+ COMMIT statement
+
+
+
+ E151-02
+ ROLLBACK statement
+
+
+
+ E152
+ Basic SET TRANSACTION statement
+
+
+
+ E152-01
+ SET TRANSACTION statement: ISOLATION LEVEL SERIALIZABLE
+ clause
+
+
+
+ E152-02
+ SET TRANSACTION statement: READ ONLY and READ WRITE clauses
+
+
+
+ E153
+ Updatable queries with subqueries
+
+
+
+ E161
+ SQL comments using leading double minus
+
+
+
+ E171
+ SQLSTATE support
+
+
+
+ E182
+ Module language
+
+
+
+ F021
+ Basic information schema
+
+
+
+ F021-01
+ COLUMNS view
+
+
+
+ F021-02
+ TABLES view
+
+
+
+ F021-03
+ VIEWS view
+
+
+
+ F021-04
+ TABLE_CONSTRAINTS view
+
+
+
+ F021-05
+ REFERENTIAL_ CONSTRAINTS view
+
+
+
+ F021-06
+ CHECK_CONSTRAINTS view
+
+
+
+ F031
+ Basic schema manipulation
+
+
+
+ F031-01
+ CREATE TABLE statement to create persistent base
+ tables
+
+
+
+ F031-02
+ CREATE VIEW statement
+
+
+
+ F031-03
+ GRANT statement
+
+
+
+ F031-04
+ ALTER TABLE statement COLUMN clause
+
+
+
+ F031-13
+ DROP TABLE statement clause
+
+
+
+ F031-16
+ DROP VIEW statement RESTRICT clause
+
+
+
+ F031-19
+ REVOKE statement RESTRICT clause
+
+
+
+ F041
+ Basic joined table
+
+
+
+ F041-01
+ Inner join (but not necessarily the INNER keyword)
+
+
+
+ F041-02
+ INNER keyword
+
+
+
+ F041-03
+ LEFT OUTER JOIN
+
+
+
+ F041-04
+ RIGHT OUTER JOIN
+
+
+
+ F041-05
+ Outer joins can be nested
+
+
+
+ F041-07
+ The inner table in a left or right outer join can also be
+ used in an inner join
+
+
+
+ F041-08
+ All comparison operators are supported
+ (rather than just =)
+
+
+
+ F051
+ Basic date and time
+
+
+
+ F051-01
+ DATE data type (including support of DATE literal)
+
+
+
+ F051-02
+ TIME data type (including support of TIME literal) with
+ fractional seconds precision of at least 0
+
+
+
+ F051-03
+ TIMESTAMP data type (including support of TIMESTAMP
+ literal) with fractional seconds precision of at least
+ 0 and 6
+
+
+
+ F051-04
+ Comparison predicate on DATE TIMESTAMP data types
+
+
+
+ F051-05
+ Explicit CAST between datetime types and character types
+
+
+
+ F051-06
+ CURRENT_DATE
+
+
+
+ F051-07
+ LOCALTIME
+
+
+
+ F051-08
+ LOCALTIMESTAMP
+
+
+
+ F081
+ UNION and EXCEPT in views
+
+
+
+ F131
+ Grouped operations
+
+
+
+ F131-01
+ WHERE, GROUP BY and HAVING clauses supported in queries
+ with grouped views
+
+
+
+ F131-02
+ Multiple tables supported in queries with grouped views
+
+
+
+ F131-03
+ Set functions supported in queries with grouped views
+
+
+
+ F131-04
+ Subqueries with GROUP BY and HAVING clauses and grouped views
+
+
+
+ F131-05
+ Single row SELECT with GROUP BY and HAVING clauses and grouped views
+
+
+
+ F181
+ Multiple module support
+
+
+
+ F201
+ CAST function
+
+
+
+ F221
+ Explicit defaults
+
+
+
+ F261
+ CASE expression
+
+
+
+ F261-01
+ Simple CASE
+
+
+
+ F261-02
+ Searched CASE
+
+
+
+ F261-03
+ NULLIF
+
+
+
+ F261-04
+ COALESCE
+
+
+
+ F311
+ Schema definition statement
+
+
+
+ F311-01
+ CREATE SCHEMA
+
+
+
+ F311-02
+ CREATE TABLE for persistent base tables
+
+
+
+ F311-03
+ CREATE VIEW
+
+
+
+ F311-04
+ CREATE VIEW: WITH CHECK OPTION
+
+
+
+ F311-05
+ GRANT statement
+
+
+
+ F471
+ Scalar subquery values
+
+
+
+ F481
+ Expanded NULL predicate
+
+
+
+ F501
+ Features and conformance views
+
+
+
+ F501-01
+ SQL_FEATURES view
+
+
+
+ F501-02
+ SQL_SIZING view
+
+
+
+ F501-03
+ SQL_LANGUAGES view
+
+
+
+ F812
+ Basic flagging
+
+
+
+ S011
+ Distinct data types
+
+
+
+ S011-01
+ USER_DEFINED_TYPES view
+
+
+
+ T321
+ Basic SQL-invoked routines
+
+
+
+ T321-01
+ User-defined functions with no overloading
+
+
+
+ T321-02
+ User-defined stored procedures with no overloading
+
+
+
+ T321-03
+ Function invocation
+
+
+
+ T321-04
+ CALL statement
+
+
+
+ T321-05
+ RETURN statement
+
+
+
+ T321-06
+ ROUTINES view
+
+
+
+ T321-07
+ PARAMETERS view
+
+
+
+ F032
+ CASCADE drop behavior
+
+
+
+ F033
+ ALTER TABLE statement: DROP COLUMN clause
+
+
+
+ F034
+ Extended REVOKE statement
+
+
+
+ F034-01
+ REVOKE statement performed by other than the owner of a schema object
+
+
+
+ F034-02
+ REVOKE statement: GRANT OPTION FOR clause
+
+
+
+ F034-03
+ REVOKE statement to revoke a privilege that the grantee has WITH GRANT OPTION
+
+
+
+ F052
+ Intervals and datetime arithmetic
+
+
+
+ F111
+ Isolation levels other than SERIALIZABLE
+
+
+
+ F111-01
+ READ UNCOMMITTED isolation level
+
+
+
+ F111-02
+ READ COMMITTED isolation level
+
+
+
+ F111-03
+ REPEATABLE READ isolation level
+
+
+
+ F121
+ Basic diagnostics management
+
+
+
+ F121-01
+ GET DIAGNOSTICS statement
+
+
+
+ F121-02
+ SET TRANSACTION statement: DIAGNOSTICS SIZE clause
+
+
+
+ F171
+ Multiple schemas per user
+
+
+
+ F191
+ Referential delete actions
+
+
+
+ F222
+ INSERT statement: DEFAULT VALUES clause
+
+
+
+ F231
+ Privilege Tables
+
+
+
+ F231-01
+ TABLE_PRIVILEGES view
+
+
+
+ F231-02
+ COLUMN_PRIVILEGES view
+
+
+
+ F231-03
+ USAGE_PRIVILEGES view
+
+
+
+ F251
+ Domain support
+
+
+
+ F271
+ Compound character literals
+
+
+
+ F281
+ LIKE enhancements
+
+
+
+ F291
+ UNIQUE predicate
+
+
+
+ F301
+ CORRESPONDING in query expressions
+
+
+
+ F302
+ INTERSECT table operator
+
+
+
+ F302-01
+ INTERSECT DISTINCT table operator
+
+
+
+ F302-02
+ INTERSECT ALL table operator
+
+
+
+ F304
+ EXCEPT ALL table operator
+
+
+
+ F321
+ User authorization
+
+
+
+ F341
+ Usage tables
+
+
+
+ F361
+ Subprogram support
+
+
+
+ F381
+ Extended schema manipulation
+
+
+
+ F381-01
+ ALTER TABLE statement: ALTER COLUMN clause
+
+
+
+ F381-02
+ ALTER TABLE statement: ADD CONSTRAINT clause
+
+
+
+ F381-03
+ ALTER TABLE statement: DROP CONSTRAINT clause
+
+
+
+ F391
+ Long identifiers
+
+
+
+ F401
+ Extended joined table
+
+
+
+ F401-01
+ NATURAL JOIN
+
+
+
+ F401-02
+ FULL OUTER JOIN
+
+
+
+ F401-03
+ UNION JOIN
+
+
+
+ F401-04
+ CROSS JOIN
+
+
+
+ F411
+ Time zone specification
+
+
+
+ F421
+ National character
+
+
+
+ F431
+ Read-only scrollable cursors
+
+
+
+ F431-01
+ FETCH with explicit NEXT
+
+
+
+ F431-02
+ FETCH FIRST
+
+
+
+ F431-03
+ FETCH LAST
+
+
+
+ F431-04
+ FETCH PRIOR
+
+
+
+ F431-05
+ FETCH ABSOLUTE
+
+
+
+ F431-06
+ FETCH RELATIVE
+
+
+
+ F441
+ Extended set function support
+
+
+
+ F451
+ Character set definition
+
+
+
+ F461
+ Named character sets
+
+
+
+ F491
+ Constraint management
+
+
+
+ F502
+ Enhanced documentation tables
+
+
+
+ F502-01
+ SQL_SIZING_PROFILES view
+
+
+
+ F502-02
+ SQL_IMPLEMENTATION_INFO view
+
+
+
+ F502-03
+ SQL_PACKAGES view
+
+
+
+ F511
+ BIT data type
+
+
+
+ F521
+ Assertions
+
+
+
+ F531
+ Temporary tables
+
+
+
+ F555
+ Enhanced seconds precision
+
+
+
+ F561
+ Full value expressions
+
+
+
+ F571
+ Truth value tests
+
+
+
+ F591
+ Derived tables
+
+
+
+ F611
+ Indicator data types
+
+
+
+ F641
+ Row and table constructors
+
+
+
+ F651
+ Catalog name qualifiers
+
+
+
+ F661
+ Simple tables
+
+
+
+ F671
+ Subqueries in CHECK
+
+
+
+ F691
+ Collation and translation
+
+
+
+ F701
+ Referential update actions
+
+
+
+ F711
+ ALTER domain
+
+
+
+ F721
+ Deferrable constraints
+
+
+
+ F731
+ INSERT column privileges
+
+
+
+ F741
+ Referential MATCH types
+
+
+
+ F751
+ View CHECK enhancements
+
+
+
+ F761
+ Session management
+
+
+
+ F771
+ Connection management
+
+
+
+ F781
+ Self-referencing operations
+
+
+
+ F791
+ Insensitive cursors
+
+
+
+ F801
+ Full set function
+
+
+
+ F811
+ Extended flagging
+
+
+
+ F813
+ Extended flagging for "Core SQL Flagging" and "Catalog
+ Lookup" only
+
+
+
+ F821
+ Local table references
+
+
+
+ F831
+ Full cursor update
+
+
+
+ F831-01
+ Updateable scrollable cursors
+
+
+
+ F831-02
+ Updateable ordered cursors
+
+
+
+ S023
+ Basic structured types
+
+
+
+ S024
+ Enhanced structured types
+
+
+
+ S041
+ Basic reference types
+
+
+
+ S043
+ Enhanced reference types
+
+
+
+ S051
+ Create table of type
+
+
+
+ S071
+ SQL paths in function and type name resolution
+
+
+
+ S081
+ Subtables
+
+
+
+ S091
+ Basic array support
+
+
+
+ S091-01
+ Arrays of built-in data types
+
+
+
+ S091-02
+ Arrays of distinct types
+
+
+
+ S091-03
+ Array expressions
+
+
+
+ S092
+ Arrays of user-defined types
+
+
+
+ S094
+ Arrays of reference types
+
+
+
+ S111
+ ONLY in query expressions
+
+
+
+ S151
+ Type predicate
+
+
+
+ S161
+ Subtype treatment
+
+
+
+ S201
+ SQL routines on arrays
+
+
+
+ S201-01
+ Array parameters
+
+
+
+ S201-02
+ Array as result type of functions
+
+
+
+ S211
+ User-defined cast functions
+
+
+
+ S231
+ Structured type locators
+
+
+
+ S232
+ Array locators
+
+
+
+ S241
+ Transform functions
+
+
+
+ S251
+ User-defined orderings
+
+
+
+ S261
+ Specific type method
+
+
+
+ T011
+ Timestamp in Information Schema
+
+
+
+ T031
+ BOOLEAN data type
+
+
+
+ T041
+ Basic LOB data type support
+
+
+
+ T041-01
+ BLOB data type
+
+
+
+ T041-02
+ CLOB data type
+
+
+
+ T041-03
+ POSITION, LENGTH, LOWER, TRIM, UPPER, and SUBSTRING
+ functions for LOB data types
+
+
+
+ T041-04
+ Concatenation of LOB data types
+
+
+
+ T041-05
+ LOB locator: non-holdable
+
+
+
+ T042
+ Extended LOB data type support
+
+
+
+ T051
+ Row types
+
+
+
+ T111
+ Updatable joins, unions, and columns
+
+
+
+ T121
+ WITH (excluding RECURSIVE) in query expression
+
+
+
+ T131
+ Recursive query
+
+
+
+ T141
+ SIMILAR predicate
+
+
+
+ T151
+ DISTINCT predicate
+
+
+
+ T171
+ LIKE clause in table definition
+
+
+
+ T191
+ Referential action RESTRICT
+
+
+
+ T201
+ Comparable data types for referential constraints
+
+
+
+ T211
+ Basic trigger capability
+
+
+
+ T211-01
+ Triggers activated on UPDATE, INSERT, or DELETE of one
+ base table
+
+
+
+ T211-02
+ BEFORE triggers
+
+
+
+ T211-03
+ AFTER triggers
+
+
+
+ T211-04
+ FOR EACH ROW triggers
+
+
+
+ T211-05
+ Ability to specify a search condition that must be true
+ before the trigger is invoked
+
+
+
+ T211-06
+ Support for run-time rules for the interaction of triggers
+ and constraints
+
+
+
+ T211-07
+ TRIGGER privilege
+
+
+
+ T211-08
+ Multiple triggers for the same the event are executed in
+ the order in which they were created
+
+
+
+ T212
+ Enhanced trigger capability
+
+
+
+ T231
+ SENSITIVE cursors
+
+
+
+ T241
+ START TRANSACTION statement
+
+
+
+ T251
+ SET TRANSACTION statement: LOCAL option
+
+
+
+ T261
+ Chained transactions
+
+
+
+ T271
+ Savepoints
+
+
+
+ T281
+ SELECT privilege with column granularity
+
+
+
+ T301
+ Functional Dependencies
+
+
+
+ T312
+ OVERLAY function
+
+
+
+ T322
+ Overloading of SQL-invoked functions and procedures
+
+
+
+ T323
+ Explicit security for external routines
+
+
+
+ T331
+ Basic roles
+
+
+
+ T332
+ Extended roles
+
+
+
+ T351
+ Bracketed SQL comments (/*...*/ comments)
+
+
+
+ T401
+ INSERT into a cursor
+
+
+
+ T411
+ UPDATE statement: SET ROW option
+
+
+
+ T431
+ CUBE and ROLLUP operations
+
+
+
+ T441
+ ABS and MOD functions
+
+
+
+ T461
+ Symmetric BETWEEN predicate
+
+
+
+ T471
+ Result sets return value
+
+
+
+ T491
+ LATERAL derived table
+
+
+
+ T501
+ Enhanced EXISTS predicate
+
+
+
+ T511
+ Transaction counts
+
+
+
+ T541
+ Updatable table references
+
+
+
+ T551
+ Optional key words for default syntax
+
+
+
+ T561
+ Holdable locators
+
+
+
+ T571
+ Array-returning external SQL-invoked functions
+
+
+
+ T581
+ Regular expression substring function
+
+
+
+ T591
+ UNIQUE constraints of possibly null columns
+
+
+
+ T601
+ Local cursor references
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 33d0d4ea67..d8c5998fb8 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -1,4 +1,4 @@
-
+
@@ -23,16 +23,17 @@
+
+
-
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 1e7e5bcde6..976147f5c2 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,5 +1,5 @@
@@ -2703,17 +2703,17 @@ PostgreSQL documentation
- current_time
- time
- Time of day; see below
-
-
-
+ current_time
+ time with time zone
+ Time of day; see below
+
+
+
current_timestamp
- timestamp
+ timestamp with time zone
Date and time; see below
@@ -2790,6 +2790,24 @@ PostgreSQL documentation
true
+
+ localtime
+ time
+ Time of day; see below
+
+
+
+
+
+
+ localtimestamp
+ timestamp
+ Date and time; see below
+
+
+
+
+
now()
timestamp
@@ -3264,40 +3282,37 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
The following functions are available to obtain the current date and/or
time:
-
+
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_TIME ( precision )
CURRENT_TIMESTAMP ( precision )
-
- CURRENT_TIME and
- CURRENT_TIMESTAMP can optionally be given
- a precision parameter, which causes the result to be rounded
- to that many fractional digits. Without a precision parameter,
- the result is given to full available precision.
-
-
-
-
- Prior to PostgreSQL 7.2, the precision parameters
- were unimplemented, and the result was always given in integer
- seconds.
+LOCALTIME
+LOCALTIMESTAMP
+LOCALTIME ( precision )
+LOCALTIMESTAMP ( precision )
+
+ CURRENT_TIME,
+ CURRENT_TIMESTAMP,
+ LOCALTIME, and
+ LOCALTIMESTAMP
+ can optionally be given
+ a precision parameter, which causes the result to be rounded
+ to that many fractional digits. Without a precision parameter,
+ the result is given to the full available precision.
-
-
-
- The SQL99 standard requires these functions to
- be written without any parentheses, unless a precision parameter
- is given. As of PostgreSQL 7.2, an empty pair of
- parentheses can be written, but this is deprecated and may be
- removed in a future release.
-
-
+
+
+ Prior to PostgreSQL 7.2, the precision
+ parameters were unimplemented, and the result was always given
+ in integer seconds.
+
+
-
-
+
+
SELECT CURRENT_TIME;
14:39:53.662522-05
@@ -3309,6 +3324,9 @@ SELECT CURRENT_TIMESTAMP;
SELECT CURRENT_TIMESTAMP(2);
2001-12-23 14:39:53.66-05
+
+SELECT LOCALTIMESTAMP;
+2001-12-23 14:39:53.662522
diff --git a/doc/src/sgml/user.sgml b/doc/src/sgml/user.sgml
index f8da13ded6..79ed594ff7 100644
--- a/doc/src/sgml/user.sgml
+++ b/doc/src/sgml/user.sgml
@@ -1,5 +1,5 @@
@@ -31,6 +31,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/user.sgml,v 1.29 2001/05/12 22:51:36
&datetime;
&keywords;
+ &features;
&biblio;
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index bfbf23e3df..b4ff1fcf50 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.322 2002/06/13 14:16:43 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.323 2002/06/15 03:00:03 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -259,7 +259,6 @@ static void doNegateFloat(Value *v);
%type row_descriptor, row_list, in_expr_nodes
%type row_expr
%type case_expr, case_arg, when_clause, case_default
-%type opt_empty_parentheses
%type when_clause_list
%type sub_type
%type OptCreateAs, CreateAsList
@@ -347,7 +346,7 @@ static void doNegateFloat(Value *v);
KEY,
LANCOMPILER, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LIMIT, LISTEN,
- LOAD, LOCAL, LOCATION, LOCK_P,
+ LOAD, LOCAL, LOCALTIME, LOCALTIMESTAMP, LOCATION, LOCK_P,
MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE,
@@ -5461,7 +5460,7 @@ c_expr: columnref
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
- | CURRENT_DATE opt_empty_parentheses
+ | CURRENT_DATE
{
/*
* Translate as "'now'::text::date".
@@ -5487,7 +5486,7 @@ c_expr: columnref
$$ = (Node *)makeTypeCast((Node *)s, d);
}
- | CURRENT_TIME opt_empty_parentheses
+ | CURRENT_TIME
{
/*
* Translate as "'now'::text::timetz".
@@ -5530,7 +5529,7 @@ c_expr: columnref
$$ = (Node *)makeTypeCast((Node *)s, d);
}
- | CURRENT_TIMESTAMP opt_empty_parentheses
+ | CURRENT_TIMESTAMP
{
/*
* Translate as "'now'::text::timestamptz".
@@ -5574,7 +5573,94 @@ c_expr: columnref
$$ = (Node *)makeTypeCast((Node *)s, d);
}
- | CURRENT_USER opt_empty_parentheses
+ | LOCALTIME
+ {
+ /*
+ * Translate as "'now'::text::time".
+ * See comments for CURRENT_DATE.
+ */
+ A_Const *s = makeNode(A_Const);
+ TypeName *d;
+
+ s->val.type = T_String;
+ s->val.val.str = "now";
+ s->typename = SystemTypeName("text");
+
+ d = SystemTypeName("time");
+ /* SQL99 mandates a default precision of zero for TIME
+ * fields in schemas. However, for LOCALTIME
+ * let's preserve the microsecond precision we
+ * might see from the system clock. - thomas 2001-12-07
+ */
+ d->typmod = 6;
+
+ $$ = (Node *)makeTypeCast((Node *)s, d);
+ }
+ | LOCALTIME '(' Iconst ')'
+ {
+ /*
+ * Translate as "'now'::text::time(n)".
+ * See comments for CURRENT_DATE.
+ */
+ A_Const *s = makeNode(A_Const);
+ TypeName *d;
+
+ s->val.type = T_String;
+ s->val.val.str = "now";
+ s->typename = SystemTypeName("text");
+ d = SystemTypeName("time");
+ if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
+ elog(ERROR, "LOCALTIME(%d) precision must be between %d and %d",
+ $3, 0, MAX_TIME_PRECISION);
+ d->typmod = $3;
+
+ $$ = (Node *)makeTypeCast((Node *)s, d);
+ }
+ | LOCALTIMESTAMP
+ {
+ /*
+ * Translate as "'now'::text::timestamp".
+ * See comments for CURRENT_DATE.
+ */
+ A_Const *s = makeNode(A_Const);
+ TypeName *d;
+
+ s->val.type = T_String;
+ s->val.val.str = "now";
+ s->typename = SystemTypeName("text");
+
+ d = SystemTypeName("timestamp");
+ /* SQL99 mandates a default precision of 6 for timestamp.
+ * Also, that is about as precise as we will get since
+ * we are using a microsecond time interface.
+ * - thomas 2001-12-07
+ */
+ d->typmod = 6;
+
+ $$ = (Node *)makeTypeCast((Node *)s, d);
+ }
+ | LOCALTIMESTAMP '(' Iconst ')'
+ {
+ /*
+ * Translate as "'now'::text::timestamp(n)".
+ * See comments for CURRENT_DATE.
+ */
+ A_Const *s = makeNode(A_Const);
+ TypeName *d;
+
+ s->val.type = T_String;
+ s->val.val.str = "now";
+ s->typename = SystemTypeName("text");
+
+ d = SystemTypeName("timestamp");
+ if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
+ elog(ERROR, "LOCALTIMESTAMP(%d) precision must be between %d and %d",
+ $3, 0, MAX_TIMESTAMP_PRECISION);
+ d->typmod = $3;
+
+ $$ = (Node *)makeTypeCast((Node *)s, d);
+ }
+ | CURRENT_USER
{
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("current_user");
@@ -5583,7 +5669,7 @@ c_expr: columnref
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
- | SESSION_USER opt_empty_parentheses
+ | SESSION_USER
{
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("session_user");
@@ -5592,7 +5678,7 @@ c_expr: columnref
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
- | USER opt_empty_parentheses
+ | USER
{
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("current_user");
@@ -5966,9 +6052,6 @@ attrs: '.' attr_name
{ $$ = lcons(makeString($2), $3); }
;
-opt_empty_parentheses: '(' ')' { $$ = TRUE; }
- | /*EMPTY*/ { $$ = TRUE; }
- ;
/*****************************************************************************
*
@@ -6572,6 +6655,8 @@ reserved_keyword:
| INTO
| LEADING
| LIMIT
+ | LOCALTIME
+ | LOCALTIMESTAMP
| NEW
| NOT
| NULL_P
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index dca44c448f..0f441290ea 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.113 2002/06/11 15:41:37 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.114 2002/06/15 03:00:03 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -172,6 +172,8 @@ static const ScanKeyword ScanKeywords[] = {
{"listen", LISTEN},
{"load", LOAD},
{"local", LOCAL},
+ {"localtime", LOCALTIME},
+ {"localtimestamp", LOCALTIMESTAMP},
{"location", LOCATION},
{"lock", LOCK_P},
{"match", MATCH},
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 39a430aff3..60fdc54f9c 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -103,6 +103,8 @@ char *mapFuncs[][2] = {
{"CURRENT_DATE", "current_date" },
{"CURRENT_TIME", "current_time" },
{"CURRENT_TIMESTAMP", "current_timestamp" },
+ {"LOCALTIME", "localtime" },
+ {"LOCALTIMESTAMP", "localtimestamp" },
{"CURRENT_USER", "cast(current_user as text)" },
{"SESSION_USER", "cast(session_user as text)" },
{"CURDATE", "current_date" },