mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-28 21:01:48 +02:00
Clean up references to SQL92
In most cases, these were just references to the SQL standard in general. In a few cases, a contrast was made between SQL92 and later standards -- those have been kept unchanged.
This commit is contained in:
parent
6e481ebff6
commit
cc26ea9fe2
@ -92,10 +92,10 @@ validOperatorName(const char *name)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For SQL92 compatibility, '+' and '-' cannot be the last char of a
|
* For SQL standard compatibility, '+' and '-' cannot be the last char of a
|
||||||
* multi-char operator unless the operator contains chars that are not in
|
* multi-char operator unless the operator contains chars that are not in
|
||||||
* SQL92 operators. The idea is to lex '=-' as two operators, but not to
|
* SQL operators. The idea is to lex '=-' as two operators, but not to
|
||||||
* forbid operator names like '?-' that could not be sequences of SQL92
|
* forbid operator names like '?-' that could not be sequences of standard SQL
|
||||||
* operators.
|
* operators.
|
||||||
*/
|
*/
|
||||||
if (len > 1 &&
|
if (len > 1 &&
|
||||||
|
@ -1618,7 +1618,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
|
|||||||
qual = resultRelInfo->ri_ConstraintExprs[i];
|
qual = resultRelInfo->ri_ConstraintExprs[i];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: SQL92 specifies that a NULL result from a constraint
|
* NOTE: SQL specifies that a NULL result from a constraint
|
||||||
* expression is not to be treated as a failure. Therefore, tell
|
* expression is not to be treated as a failure. Therefore, tell
|
||||||
* ExecQual to return TRUE for NULL.
|
* ExecQual to return TRUE for NULL.
|
||||||
*/
|
*/
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
* NOTES
|
* NOTES
|
||||||
* CAPITALS are used to represent terminal symbols.
|
* CAPITALS are used to represent terminal symbols.
|
||||||
* non-capitals are used to represent non-terminals.
|
* non-capitals are used to represent non-terminals.
|
||||||
* SQL92-specific syntax is separated from plain SQL/Postgres syntax
|
|
||||||
* to help isolate the non-extensible portions of the parser.
|
|
||||||
*
|
*
|
||||||
* In general, nothing in this file should initiate database accesses
|
* In general, nothing in this file should initiate database accesses
|
||||||
* nor depend on changeable state (such as SET variables). If you do
|
* nor depend on changeable state (such as SET variables). If you do
|
||||||
@ -1281,7 +1279,7 @@ schema_stmt:
|
|||||||
*
|
*
|
||||||
* Set PG internal variable
|
* Set PG internal variable
|
||||||
* SET name TO 'var_value'
|
* SET name TO 'var_value'
|
||||||
* Include SQL92 syntax (thomas 1997-10-22):
|
* Include SQL syntax (thomas 1997-10-22):
|
||||||
* SET TIME ZONE 'var_value'
|
* SET TIME ZONE 'var_value'
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -2780,7 +2778,7 @@ ColConstraint:
|
|||||||
* to make it explicit.
|
* to make it explicit.
|
||||||
* - thomas 1998-09-13
|
* - thomas 1998-09-13
|
||||||
*
|
*
|
||||||
* WITH NULL and NULL are not SQL92-standard syntax elements,
|
* WITH NULL and NULL are not SQL-standard syntax elements,
|
||||||
* so leave them out. Use DEFAULT NULL to explicitly indicate
|
* so leave them out. Use DEFAULT NULL to explicitly indicate
|
||||||
* that a column may have that value. WITH NULL leads to
|
* that a column may have that value. WITH NULL leads to
|
||||||
* shift/reduce conflicts with WITH TIME ZONE anyway.
|
* shift/reduce conflicts with WITH TIME ZONE anyway.
|
||||||
@ -9159,7 +9157,7 @@ select_clause:
|
|||||||
* As with select_no_parens, simple_select cannot have outer parentheses,
|
* As with select_no_parens, simple_select cannot have outer parentheses,
|
||||||
* but can have parenthesized subclauses.
|
* but can have parenthesized subclauses.
|
||||||
*
|
*
|
||||||
* Note that sort clauses cannot be included at this level --- SQL92 requires
|
* Note that sort clauses cannot be included at this level --- SQL requires
|
||||||
* SELECT foo UNION SELECT bar ORDER BY baz
|
* SELECT foo UNION SELECT bar ORDER BY baz
|
||||||
* to be parsed as
|
* to be parsed as
|
||||||
* (SELECT foo UNION SELECT bar) ORDER BY baz
|
* (SELECT foo UNION SELECT bar) ORDER BY baz
|
||||||
@ -9660,7 +9658,7 @@ table_ref: relation_expr opt_alias_clause
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* It may seem silly to separate joined_table from table_ref, but there is
|
* It may seem silly to separate joined_table from table_ref, but there is
|
||||||
* method in SQL92's madness: if you don't do it this way you get reduce-
|
* method in SQL's madness: if you don't do it this way you get reduce-
|
||||||
* reduce conflicts, because it's not clear to the parser generator whether
|
* reduce conflicts, because it's not clear to the parser generator whether
|
||||||
* to expect alias_clause after ')' or not. For the same reason we must
|
* to expect alias_clause after ')' or not. For the same reason we must
|
||||||
* treat 'JOIN' and 'join_type JOIN' separately, rather than allowing
|
* treat 'JOIN' and 'join_type JOIN' separately, rather than allowing
|
||||||
@ -9959,7 +9957,7 @@ TableFuncElement: ColId Typename opt_collate_clause
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Type syntax
|
* Type syntax
|
||||||
* SQL92 introduces a large amount of type-specific syntax.
|
* SQL introduces a large amount of type-specific syntax.
|
||||||
* Define individual clauses to handle these cases, and use
|
* Define individual clauses to handle these cases, and use
|
||||||
* the generic case to handle regular type-extensible Postgres syntax.
|
* the generic case to handle regular type-extensible Postgres syntax.
|
||||||
* - thomas 1997-10-10
|
* - thomas 1997-10-10
|
||||||
@ -10085,7 +10083,7 @@ opt_type_modifiers: '(' expr_list ')' { $$ = $2; }
|
|||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SQL92 numeric data types
|
* SQL numeric data types
|
||||||
*/
|
*/
|
||||||
Numeric: INT_P
|
Numeric: INT_P
|
||||||
{
|
{
|
||||||
@ -10175,7 +10173,7 @@ opt_float: '(' Iconst ')'
|
|||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SQL92 bit-field data types
|
* SQL bit-field data types
|
||||||
* The following implements BIT() and BIT VARYING().
|
* The following implements BIT() and BIT VARYING().
|
||||||
*/
|
*/
|
||||||
Bit: BitWithLength
|
Bit: BitWithLength
|
||||||
@ -10232,7 +10230,7 @@ BitWithoutLength:
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SQL92 character data types
|
* SQL character data types
|
||||||
* The following implements CHAR() and VARCHAR().
|
* The following implements CHAR() and VARCHAR().
|
||||||
*/
|
*/
|
||||||
Character: CharacterWithLength
|
Character: CharacterWithLength
|
||||||
@ -10329,7 +10327,7 @@ opt_charset:
|
|||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SQL92 date/time types
|
* SQL date/time types
|
||||||
*/
|
*/
|
||||||
ConstDatetime:
|
ConstDatetime:
|
||||||
TIMESTAMP '(' Iconst ')' opt_timezone
|
TIMESTAMP '(' Iconst ')' opt_timezone
|
||||||
@ -10661,7 +10659,7 @@ a_expr: c_expr { $$ = $1; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* NullTest clause
|
/* NullTest clause
|
||||||
* Define SQL92-style Null test clause.
|
* Define SQL-style Null test clause.
|
||||||
* Allow two forms described in the standard:
|
* Allow two forms described in the standard:
|
||||||
* a IS NULL
|
* a IS NULL
|
||||||
* a IS NOT NULL
|
* a IS NOT NULL
|
||||||
@ -11189,7 +11187,7 @@ func_expr: func_name '(' ')' over_clause
|
|||||||
/*
|
/*
|
||||||
* We consider AGGREGATE(*) to invoke a parameterless
|
* We consider AGGREGATE(*) to invoke a parameterless
|
||||||
* aggregate. This does the right thing for COUNT(*),
|
* aggregate. This does the right thing for COUNT(*),
|
||||||
* and there are no other aggregates in SQL92 that accept
|
* and there are no other aggregates in SQL that accept
|
||||||
* '*' as parameter.
|
* '*' as parameter.
|
||||||
*
|
*
|
||||||
* The FuncCall node is also marked agg_star = true,
|
* The FuncCall node is also marked agg_star = true,
|
||||||
@ -11505,7 +11503,7 @@ func_expr: func_name '(' ')' over_clause
|
|||||||
}
|
}
|
||||||
| TRIM '(' BOTH trim_list ')'
|
| TRIM '(' BOTH trim_list ')'
|
||||||
{
|
{
|
||||||
/* various trim expressions are defined in SQL92
|
/* various trim expressions are defined in SQL
|
||||||
* - thomas 1997-07-19
|
* - thomas 1997-07-19
|
||||||
*/
|
*/
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
@ -12208,7 +12206,7 @@ in_expr: select_with_parens
|
|||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define SQL92-style case clause.
|
* Define SQL-style CASE clause.
|
||||||
* - Full specification
|
* - Full specification
|
||||||
* CASE WHEN a = b THEN c ... ELSE d END
|
* CASE WHEN a = b THEN c ... ELSE d END
|
||||||
* - Implicit argument
|
* - Implicit argument
|
||||||
|
@ -70,7 +70,7 @@ static bool isQueryUsingTempRelation_walker(Node *node, void *context);
|
|||||||
* that (a) has no alias and (b) is for the same relation identified by
|
* that (a) has no alias and (b) is for the same relation identified by
|
||||||
* schemaname.refname. In this case we convert schemaname.refname to a
|
* schemaname.refname. In this case we convert schemaname.refname to a
|
||||||
* relation OID and search by relid, rather than by alias name. This is
|
* relation OID and search by relid, rather than by alias name. This is
|
||||||
* peculiar, but it's what SQL92 says to do.
|
* peculiar, but it's what SQL says to do.
|
||||||
*/
|
*/
|
||||||
RangeTblEntry *
|
RangeTblEntry *
|
||||||
refnameRangeTblEntry(ParseState *pstate,
|
refnameRangeTblEntry(ParseState *pstate,
|
||||||
@ -353,7 +353,7 @@ searchRangeTableForRel(ParseState *pstate, RangeVar *relation)
|
|||||||
* Note: we assume that each given argument does not contain conflicts
|
* Note: we assume that each given argument does not contain conflicts
|
||||||
* itself; we just want to know if the two can be merged together.
|
* itself; we just want to know if the two can be merged together.
|
||||||
*
|
*
|
||||||
* Per SQL92, two alias-less plain relation RTEs do not conflict even if
|
* Per SQL, two alias-less plain relation RTEs do not conflict even if
|
||||||
* they have the same eref->aliasname (ie, same relation name), if they
|
* they have the same eref->aliasname (ie, same relation name), if they
|
||||||
* are for different relation OIDs (implying they are in different schemas).
|
* are for different relation OIDs (implying they are in different schemas).
|
||||||
*
|
*
|
||||||
@ -389,7 +389,7 @@ checkNameSpaceConflicts(ParseState *pstate, List *namespace1,
|
|||||||
if (rte1->rtekind == RTE_RELATION && rte1->alias == NULL &&
|
if (rte1->rtekind == RTE_RELATION && rte1->alias == NULL &&
|
||||||
rte2->rtekind == RTE_RELATION && rte2->alias == NULL &&
|
rte2->rtekind == RTE_RELATION && rte2->alias == NULL &&
|
||||||
rte1->relid != rte2->relid)
|
rte1->relid != rte2->relid)
|
||||||
continue; /* no conflict per SQL92 rule */
|
continue; /* no conflict per SQL rule */
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DUPLICATE_ALIAS),
|
(errcode(ERRCODE_DUPLICATE_ALIAS),
|
||||||
errmsg("table name \"%s\" specified more than once",
|
errmsg("table name \"%s\" specified more than once",
|
||||||
|
@ -133,7 +133,7 @@ static void setSchemaName(char *context_schema, char **stmt_schema_name);
|
|||||||
* will be the transformed CreateStmt, but there may be additional actions
|
* will be the transformed CreateStmt, but there may be additional actions
|
||||||
* to be done before and after the actual DefineRelation() call.
|
* to be done before and after the actual DefineRelation() call.
|
||||||
*
|
*
|
||||||
* SQL92 allows constraints to be scattered all over, so thumb through
|
* SQL allows constraints to be scattered all over, so thumb through
|
||||||
* the columns and collect all constraints into one place.
|
* the columns and collect all constraints into one place.
|
||||||
* If there are any implied indices (e.g. UNIQUE or PRIMARY KEY)
|
* If there are any implied indices (e.g. UNIQUE or PRIMARY KEY)
|
||||||
* then expand those into multiple IndexStmt blocks.
|
* then expand those into multiple IndexStmt blocks.
|
||||||
@ -1405,7 +1405,7 @@ transformIndexConstraints(CreateStmtContext *cxt)
|
|||||||
/*
|
/*
|
||||||
* Scan the index list and remove any redundant index specifications. This
|
* Scan the index list and remove any redundant index specifications. This
|
||||||
* can happen if, for instance, the user writes UNIQUE PRIMARY KEY. A
|
* can happen if, for instance, the user writes UNIQUE PRIMARY KEY. A
|
||||||
* strict reading of SQL92 would suggest raising an error instead, but
|
* strict reading of SQL would suggest raising an error instead, but
|
||||||
* that strikes me as too anal-retentive. - tgl 2001-02-14
|
* that strikes me as too anal-retentive. - tgl 2001-02-14
|
||||||
*
|
*
|
||||||
* XXX in ALTER TABLE case, it'd be nice to look for duplicate
|
* XXX in ALTER TABLE case, it'd be nice to look for duplicate
|
||||||
@ -2691,7 +2691,7 @@ transformColumnType(CreateStmtContext *cxt, ColumnDef *column)
|
|||||||
* that the logic we use for determining forward references is
|
* that the logic we use for determining forward references is
|
||||||
* presently quite incomplete.
|
* presently quite incomplete.
|
||||||
*
|
*
|
||||||
* SQL92 also allows constraints to make forward references, so thumb through
|
* SQL also allows constraints to make forward references, so thumb through
|
||||||
* the table columns and move forward references to a posterior alter-table
|
* the table columns and move forward references to a posterior alter-table
|
||||||
* command.
|
* command.
|
||||||
*
|
*
|
||||||
|
@ -1603,7 +1603,7 @@ DoPortalRunFetch(Portal portal,
|
|||||||
forward = (fdirection == FETCH_FORWARD);
|
forward = (fdirection == FETCH_FORWARD);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero count means to re-fetch the current row, if any (per SQL92)
|
* Zero count means to re-fetch the current row, if any (per SQL)
|
||||||
*/
|
*/
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* date.c
|
* date.c
|
||||||
* implements DATE and TIME data types specified in SQL-92 standard
|
* implements DATE and TIME data types specified in SQL standard
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||||
@ -1403,9 +1403,9 @@ time_smaller(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_TIMEADT((time1 < time2) ? time1 : time2);
|
PG_RETURN_TIMEADT((time1 < time2) ? time1 : time2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* overlaps_time() --- implements the SQL92 OVERLAPS operator.
|
/* overlaps_time() --- implements the SQL OVERLAPS operator.
|
||||||
*
|
*
|
||||||
* Algorithm is per SQL92 spec. This is much harder than you'd think
|
* Algorithm is per SQL spec. This is much harder than you'd think
|
||||||
* because the spec requires us to deliver a non-null answer in some cases
|
* because the spec requires us to deliver a non-null answer in some cases
|
||||||
* where some of the inputs are null.
|
* where some of the inputs are null.
|
||||||
*/
|
*/
|
||||||
@ -2273,9 +2273,9 @@ timetz_mi_interval(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_TIMETZADT_P(result);
|
PG_RETURN_TIMETZADT_P(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* overlaps_timetz() --- implements the SQL92 OVERLAPS operator.
|
/* overlaps_timetz() --- implements the SQL OVERLAPS operator.
|
||||||
*
|
*
|
||||||
* Algorithm is per SQL92 spec. This is much harder than you'd think
|
* Algorithm is per SQL spec. This is much harder than you'd think
|
||||||
* because the spec requires us to deliver a non-null answer in some cases
|
* because the spec requires us to deliver a non-null answer in some cases
|
||||||
* where some of the inputs are null.
|
* where some of the inputs are null.
|
||||||
*/
|
*/
|
||||||
|
@ -1558,8 +1558,8 @@ overflow:
|
|||||||
* Returns 0 if successful, DTERR code if bogus input detected.
|
* Returns 0 if successful, DTERR code if bogus input detected.
|
||||||
*
|
*
|
||||||
* Note that support for time zone is here for
|
* Note that support for time zone is here for
|
||||||
* SQL92 TIME WITH TIME ZONE, but it reveals
|
* SQL TIME WITH TIME ZONE, but it reveals
|
||||||
* bogosity with SQL92 date/time standards, since
|
* bogosity with SQL date/time standards, since
|
||||||
* we must infer a time zone from current time.
|
* we must infer a time zone from current time.
|
||||||
* - thomas 2000-03-10
|
* - thomas 2000-03-10
|
||||||
* Allow specifying date to get a better time zone,
|
* Allow specifying date to get a better time zone,
|
||||||
|
@ -1922,7 +1922,7 @@ float8_avg(PG_FUNCTION_ARGS)
|
|||||||
sumX = transvalues[1];
|
sumX = transvalues[1];
|
||||||
/* ignore sumX2 */
|
/* ignore sumX2 */
|
||||||
|
|
||||||
/* SQL92 defines AVG of no values to be NULL */
|
/* SQL defines AVG of no values to be NULL */
|
||||||
if (N == 0.0)
|
if (N == 0.0)
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
*
|
*
|
||||||
* Keith Parks. <keith@mtcc.demon.co.uk>
|
* Keith Parks. <keith@mtcc.demon.co.uk>
|
||||||
*
|
*
|
||||||
* SQL92 lets you specify the escape character by saying
|
* SQL lets you specify the escape character by saying
|
||||||
* LIKE <pattern> ESCAPE <escape character>. We are a small operation
|
* LIKE <pattern> ESCAPE <escape character>. We are a small operation
|
||||||
* so we force you to use '\'. - ay 7/95
|
* so we force you to use '\'. - ay 7/95
|
||||||
*
|
*
|
||||||
|
@ -2645,7 +2645,7 @@ numeric_avg(PG_FUNCTION_ARGS)
|
|||||||
N = DatumGetNumeric(transdatums[0]);
|
N = DatumGetNumeric(transdatums[0]);
|
||||||
sumX = DatumGetNumeric(transdatums[1]);
|
sumX = DatumGetNumeric(transdatums[1]);
|
||||||
|
|
||||||
/* SQL92 defines AVG of no values to be NULL */
|
/* SQL defines AVG of no values to be NULL */
|
||||||
/* N is zero iff no digits (cf. numeric_uminus) */
|
/* N is zero iff no digits (cf. numeric_uminus) */
|
||||||
if (NUMERIC_NDIGITS(N) == 0)
|
if (NUMERIC_NDIGITS(N) == 0)
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
@ -2824,7 +2824,7 @@ numeric_stddev_pop(PG_FUNCTION_ARGS)
|
|||||||
* purposes. (The latter two therefore don't really belong in this file,
|
* purposes. (The latter two therefore don't really belong in this file,
|
||||||
* but we keep them here anyway.)
|
* but we keep them here anyway.)
|
||||||
*
|
*
|
||||||
* Because SQL92 defines the SUM() of no values to be NULL, not zero,
|
* Because SQL defines the SUM() of no values to be NULL, not zero,
|
||||||
* the initial condition of the transition data value needs to be NULL. This
|
* the initial condition of the transition data value needs to be NULL. This
|
||||||
* means we can't rely on ExecAgg to automatically insert the first non-null
|
* means we can't rely on ExecAgg to automatically insert the first non-null
|
||||||
* data value into the transition data: it doesn't know how to do the type
|
* data value into the transition data: it doesn't know how to do the type
|
||||||
@ -3046,7 +3046,7 @@ int8_avg(PG_FUNCTION_ARGS)
|
|||||||
elog(ERROR, "expected 2-element int8 array");
|
elog(ERROR, "expected 2-element int8 array");
|
||||||
transdata = (Int8TransTypeData *) ARR_DATA_PTR(transarray);
|
transdata = (Int8TransTypeData *) ARR_DATA_PTR(transarray);
|
||||||
|
|
||||||
/* SQL92 defines AVG of no values to be NULL */
|
/* SQL defines AVG of no values to be NULL */
|
||||||
if (transdata->count == 0)
|
if (transdata->count == 0)
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* timestamp.c
|
* timestamp.c
|
||||||
* Functions for the built-in SQL92 types "timestamp" and "interval".
|
* Functions for the built-in SQL types "timestamp" and "interval".
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
@ -2276,9 +2276,9 @@ interval_hash(PG_FUNCTION_ARGS)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* overlaps_timestamp() --- implements the SQL92 OVERLAPS operator.
|
/* overlaps_timestamp() --- implements the SQL OVERLAPS operator.
|
||||||
*
|
*
|
||||||
* Algorithm is per SQL92 spec. This is much harder than you'd think
|
* Algorithm is per SQL spec. This is much harder than you'd think
|
||||||
* because the spec requires us to deliver a non-null answer in some cases
|
* because the spec requires us to deliver a non-null answer in some cases
|
||||||
* where some of the inputs are null.
|
* where some of the inputs are null.
|
||||||
*/
|
*/
|
||||||
@ -3129,7 +3129,7 @@ interval_avg(PG_FUNCTION_ARGS)
|
|||||||
memcpy((void *) &sumX, DatumGetPointer(transdatums[0]), sizeof(Interval));
|
memcpy((void *) &sumX, DatumGetPointer(transdatums[0]), sizeof(Interval));
|
||||||
memcpy((void *) &N, DatumGetPointer(transdatums[1]), sizeof(Interval));
|
memcpy((void *) &N, DatumGetPointer(transdatums[1]), sizeof(Interval));
|
||||||
|
|
||||||
/* SQL92 defines AVG of no values to be NULL */
|
/* SQL defines AVG of no values to be NULL */
|
||||||
if (N.time == 0)
|
if (N.time == 0)
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
|
|
||||||
|
@ -720,18 +720,18 @@ charlen_to_bytelen(const char *p, int n)
|
|||||||
* - string length
|
* - string length
|
||||||
*
|
*
|
||||||
* If the starting position is zero or less, then return from the start of the string
|
* If the starting position is zero or less, then return from the start of the string
|
||||||
* adjusting the length to be consistent with the "negative start" per SQL92.
|
* adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
* If the length is less than zero, return the remaining string.
|
* If the length is less than zero, return the remaining string.
|
||||||
*
|
*
|
||||||
* Added multibyte support.
|
* Added multibyte support.
|
||||||
* - Tatsuo Ishii 1998-4-21
|
* - Tatsuo Ishii 1998-4-21
|
||||||
* Changed behavior if starting position is less than one to conform to SQL92 behavior.
|
* Changed behavior if starting position is less than one to conform to SQL behavior.
|
||||||
* Formerly returned the entire string; now returns a portion.
|
* Formerly returned the entire string; now returns a portion.
|
||||||
* - Thomas Lockhart 1998-12-10
|
* - Thomas Lockhart 1998-12-10
|
||||||
* Now uses faster TOAST-slicing interface
|
* Now uses faster TOAST-slicing interface
|
||||||
* - John Gray 2002-02-22
|
* - John Gray 2002-02-22
|
||||||
* Remove "#ifdef MULTIBYTE" and test for encoding_max_length instead. Change
|
* Remove "#ifdef MULTIBYTE" and test for encoding_max_length instead. Change
|
||||||
* behaviors conflicting with SQL92 to meet SQL92 (if E = S + L < S throw
|
* behaviors conflicting with SQL to meet SQL (if E = S + L < S throw
|
||||||
* error; if E < 1, return '', not entire string). Fixed MB related bug when
|
* error; if E < 1, return '', not entire string). Fixed MB related bug when
|
||||||
* S > LC and < LC + 4 sometimes garbage characters are returned.
|
* S > LC and < LC + 4 sometimes garbage characters are returned.
|
||||||
* - Joe Conway 2002-08-10
|
* - Joe Conway 2002-08-10
|
||||||
@ -1023,7 +1023,7 @@ text_overlay(text *t1, text *t2, int sp, int sl)
|
|||||||
/*
|
/*
|
||||||
* textpos -
|
* textpos -
|
||||||
* Return the position of the specified substring.
|
* Return the position of the specified substring.
|
||||||
* Implements the SQL92 POSITION() function.
|
* Implements the SQL POSITION() function.
|
||||||
* Ref: A Guide To The SQL Standard, Date & Darwen, 1997
|
* Ref: A Guide To The SQL Standard, Date & Darwen, 1997
|
||||||
* - thomas 1997-07-27
|
* - thomas 1997-07-27
|
||||||
*/
|
*/
|
||||||
@ -1903,7 +1903,7 @@ bytea_catenate(bytea *t1, bytea *t2)
|
|||||||
* - string length (optional)
|
* - string length (optional)
|
||||||
*
|
*
|
||||||
* If the starting position is zero or less, then return from the start of the string
|
* If the starting position is zero or less, then return from the start of the string
|
||||||
* adjusting the length to be consistent with the "negative start" per SQL92.
|
* adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
* If the length is less than zero, an ERROR is thrown. If no third argument
|
* If the length is less than zero, an ERROR is thrown. If no third argument
|
||||||
* (length) is provided, the length to the end of the string is assumed.
|
* (length) is provided, the length to the end of the string is assumed.
|
||||||
*/
|
*/
|
||||||
@ -2046,7 +2046,7 @@ bytea_overlay(bytea *t1, bytea *t2, int sp, int sl)
|
|||||||
/*
|
/*
|
||||||
* byteapos -
|
* byteapos -
|
||||||
* Return the position of the specified substring.
|
* Return the position of the specified substring.
|
||||||
* Implements the SQL92 POSITION() function.
|
* Implements the SQL POSITION() function.
|
||||||
* Cloned from textpos and modified as required.
|
* Cloned from textpos and modified as required.
|
||||||
*/
|
*/
|
||||||
Datum
|
Datum
|
||||||
|
@ -1509,7 +1509,7 @@ typedef struct CreateStmt
|
|||||||
|
|
||||||
typedef enum ConstrType /* types of constraints */
|
typedef enum ConstrType /* types of constraints */
|
||||||
{
|
{
|
||||||
CONSTR_NULL, /* not SQL92, but a lot of people expect it */
|
CONSTR_NULL, /* not standard SQL, but a lot of people expect it */
|
||||||
CONSTR_NOTNULL,
|
CONSTR_NOTNULL,
|
||||||
CONSTR_DEFAULT,
|
CONSTR_DEFAULT,
|
||||||
CONSTR_CHECK,
|
CONSTR_CHECK,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* date.h
|
* date.h
|
||||||
* Definitions for the SQL92 "date" and "time" types.
|
* Definitions for the SQL "date" and "time" types.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* timestamp.h
|
* timestamp.h
|
||||||
* Definitions for the SQL92 "timestamp" and "interval" types.
|
* Definitions for the SQL "timestamp" and "interval" types.
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
|
@ -269,7 +269,7 @@ param \${integer}
|
|||||||
* In order to make the world safe for Windows and Mac clients as well as
|
* In order to make the world safe for Windows and Mac clients as well as
|
||||||
* Unix ones, we accept either \n or \r as a newline. A DOS-style \r\n
|
* Unix ones, we accept either \n or \r as a newline. A DOS-style \r\n
|
||||||
* sequence will be seen as two successive newlines, but that doesn't cause
|
* sequence will be seen as two successive newlines, but that doesn't cause
|
||||||
* any problems. SQL92-style comments, which start with -- and extend to the
|
* any problems. SQL-style comments, which start with -- and extend to the
|
||||||
* next newline, are treated as equivalent to a single whitespace character.
|
* next newline, are treated as equivalent to a single whitespace character.
|
||||||
*
|
*
|
||||||
* NOTE a fine point: if there is no newline following --, we will absorb
|
* NOTE a fine point: if there is no newline following --, we will absorb
|
||||||
@ -295,7 +295,7 @@ comment ("--"{non_newline}*)
|
|||||||
whitespace ({space}+|{comment})
|
whitespace ({space}+|{comment})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SQL92 requires at least one newline in the whitespace separating
|
* SQL requires at least one newline in the whitespace separating
|
||||||
* string literals that are to be concatenated. Silly, but who are we
|
* string literals that are to be concatenated. Silly, but who are we
|
||||||
* to argue? Note that {whitespace_with_newline} should not have * after
|
* to argue? Note that {whitespace_with_newline} should not have * after
|
||||||
* it, whereas {whitespace} should generally have a * after it...
|
* it, whereas {whitespace} should generally have a * after it...
|
||||||
|
@ -366,7 +366,7 @@ SELECT '' AS tf_12_ff_4, BOOLTBL1.*, BOOLTBL2.*
|
|||||||
(16 rows)
|
(16 rows)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- SQL92 syntax
|
-- SQL syntax
|
||||||
-- Try all combinations to ensure that we get nothing when we expect nothing
|
-- Try all combinations to ensure that we get nothing when we expect nothing
|
||||||
-- - thomas 2000-01-04
|
-- - thomas 2000-01-04
|
||||||
--
|
--
|
||||||
|
@ -163,7 +163,7 @@ SELECT '' AS "Five",
|
|||||||
--
|
--
|
||||||
-- NULLIF() and COALESCE()
|
-- NULLIF() and COALESCE()
|
||||||
-- Shorthand forms for typical CASE constructs
|
-- Shorthand forms for typical CASE constructs
|
||||||
-- defined in the SQL92 standard.
|
-- defined in the SQL standard.
|
||||||
--
|
--
|
||||||
SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4;
|
SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4;
|
||||||
i | f
|
i | f
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
-- STRINGS
|
-- STRINGS
|
||||||
-- Test various data entry syntaxes.
|
-- Test various data entry syntaxes.
|
||||||
--
|
--
|
||||||
-- SQL92 string continuation syntax
|
-- SQL string continuation syntax
|
||||||
-- E021-03 character string literals
|
-- E021-03 character string literals
|
||||||
SELECT 'first line'
|
SELECT 'first line'
|
||||||
' - next line'
|
' - next line'
|
||||||
@ -272,7 +272,7 @@ SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- test SQL92 string functions
|
-- test SQL string functions
|
||||||
-- E### and T### are feature reference numbers from SQL99
|
-- E### and T### are feature reference numbers from SQL99
|
||||||
--
|
--
|
||||||
-- E021-09 trim function
|
-- E021-09 trim function
|
||||||
@ -1076,7 +1076,7 @@ alter table toasttest alter column f1 set storage external;
|
|||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
substr
|
substr
|
||||||
--------
|
--------
|
||||||
@ -1126,7 +1126,7 @@ alter table toasttest alter column f1 set storage external;
|
|||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
substr
|
substr
|
||||||
--------
|
--------
|
||||||
|
@ -119,7 +119,7 @@ INSERT INTO INSERT_TBL(y) VALUES ('Y');
|
|||||||
|
|
||||||
SELECT 'eight' AS one, currval('insert_seq');
|
SELECT 'eight' AS one, currval('insert_seq');
|
||||||
|
|
||||||
-- According to SQL92, it is OK to insert a record that gives rise to NULL
|
-- According to SQL, it is OK to insert a record that gives rise to NULL
|
||||||
-- constraint-condition results. Postgres used to reject this, but it
|
-- constraint-condition results. Postgres used to reject this, but it
|
||||||
-- was wrong:
|
-- was wrong:
|
||||||
INSERT INTO INSERT_TBL VALUES (null, null, null);
|
INSERT INTO INSERT_TBL VALUES (null, null, null);
|
||||||
|
@ -188,7 +188,7 @@ SELECT 'eight' AS one, currval('insert_seq');
|
|||||||
eight | 8
|
eight | 8
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- According to SQL92, it is OK to insert a record that gives rise to NULL
|
-- According to SQL, it is OK to insert a record that gives rise to NULL
|
||||||
-- constraint-condition results. Postgres used to reject this, but it
|
-- constraint-condition results. Postgres used to reject this, but it
|
||||||
-- was wrong:
|
-- was wrong:
|
||||||
INSERT INTO INSERT_TBL VALUES (null, null, null);
|
INSERT INTO INSERT_TBL VALUES (null, null, null);
|
||||||
|
@ -164,7 +164,7 @@ SELECT '' AS tf_12_ff_4, BOOLTBL1.*, BOOLTBL2.*
|
|||||||
ORDER BY BOOLTBL1.f1, BOOLTBL2.f1;
|
ORDER BY BOOLTBL1.f1, BOOLTBL2.f1;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- SQL92 syntax
|
-- SQL syntax
|
||||||
-- Try all combinations to ensure that we get nothing when we expect nothing
|
-- Try all combinations to ensure that we get nothing when we expect nothing
|
||||||
-- - thomas 2000-01-04
|
-- - thomas 2000-01-04
|
||||||
--
|
--
|
||||||
|
@ -110,7 +110,7 @@ SELECT '' AS "Five",
|
|||||||
--
|
--
|
||||||
-- NULLIF() and COALESCE()
|
-- NULLIF() and COALESCE()
|
||||||
-- Shorthand forms for typical CASE constructs
|
-- Shorthand forms for typical CASE constructs
|
||||||
-- defined in the SQL92 standard.
|
-- defined in the SQL standard.
|
||||||
--
|
--
|
||||||
|
|
||||||
SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4;
|
SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
-- Test various data entry syntaxes.
|
-- Test various data entry syntaxes.
|
||||||
--
|
--
|
||||||
|
|
||||||
-- SQL92 string continuation syntax
|
-- SQL string continuation syntax
|
||||||
-- E021-03 character string literals
|
-- E021-03 character string literals
|
||||||
SELECT 'first line'
|
SELECT 'first line'
|
||||||
' - next line'
|
' - next line'
|
||||||
@ -92,7 +92,7 @@ SELECT CAST(f1 AS varchar) AS "varchar(char)" FROM CHAR_TBL;
|
|||||||
SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
|
SELECT CAST(name 'namefield' AS varchar) AS "varchar(name)";
|
||||||
|
|
||||||
--
|
--
|
||||||
-- test SQL92 string functions
|
-- test SQL string functions
|
||||||
-- E### and T### are feature reference numbers from SQL99
|
-- E### and T### are feature reference numbers from SQL99
|
||||||
--
|
--
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ insert into toasttest values(repeat('1234567890',10000));
|
|||||||
insert into toasttest values(repeat('1234567890',10000));
|
insert into toasttest values(repeat('1234567890',10000));
|
||||||
|
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
|
|
||||||
-- If the length is less than zero, an ERROR is thrown.
|
-- If the length is less than zero, an ERROR is thrown.
|
||||||
@ -378,7 +378,7 @@ insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
|||||||
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
insert into toasttest values(decode(repeat('1234567890',10000),'escape'));
|
||||||
|
|
||||||
-- If the starting position is zero or less, then return from the start of the string
|
-- If the starting position is zero or less, then return from the start of the string
|
||||||
-- adjusting the length to be consistent with the "negative start" per SQL92.
|
-- adjusting the length to be consistent with the "negative start" per SQL.
|
||||||
SELECT substr(f1, -1, 5) from toasttest;
|
SELECT substr(f1, -1, 5) from toasttest;
|
||||||
|
|
||||||
-- If the length is less than zero, an ERROR is thrown.
|
-- If the length is less than zero, an ERROR is thrown.
|
||||||
|
Loading…
Reference in New Issue
Block a user