aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>2000-03-14 23:06:59 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>2000-03-14 23:06:59 +0000
commit64568100787a5d03d036e70b32147385a35245e2 (patch)
tree4b6091aedff9deed40992a05d1cacf9ce1b54c8b /src/backend/utils/adt/ruleutils.c
parentce543b2121a772d18e25e1efbad252dcd360df96 (diff)
downloadpostgresql-64568100787a5d03d036e70b32147385a35245e2.tar.gz
postgresql-64568100787a5d03d036e70b32147385a35245e2.zip
Implement column aliases on views "CREATE VIEW name (collist)".
Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index bdeaf440829..59ec46a85aa 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* out of its tuple
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.44 2000/02/26 21:13:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.45 2000/03/14 23:06:37 thomas Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -923,6 +923,8 @@ get_select_query_def(Query *query, deparse_context *context)
continue;
rte = (RangeTblEntry *) lfirst(l);
+ if (rte->ref == NULL)
+ continue;
if (!strcmp(rte->ref->relname, "*NEW*"))
continue;
if (!strcmp(rte->ref->relname, "*CURRENT*"))
@@ -982,9 +984,10 @@ get_select_query_def(Query *query, deparse_context *context)
{
rte = (RangeTblEntry *) lfirst(l);
+ if (rte->ref == NULL)
+ continue;
if (!strcmp(rte->ref->relname, "*NEW*"))
continue;
-
if (!strcmp(rte->ref->relname, "*CURRENT*"))
continue;
@@ -1008,7 +1011,9 @@ get_select_query_def(Query *query, deparse_context *context)
* Since we don't really support SQL joins yet, dropping
* the list of column aliases doesn't hurt anything...
*/
- if (strcmp(rte->relname, rte->ref->relname) != 0)
+ if ((rte->ref != NULL)
+ && ((strcmp(rte->relname, rte->ref->relname) != 0)
+ || (rte->ref->attrs != NIL)))
{
appendStringInfo(buf, " %s",
quote_identifier(rte->ref->relname));
@@ -1104,6 +1109,8 @@ get_insert_query_def(Query *query, deparse_context *context)
continue;
rte = (RangeTblEntry *) lfirst(l);
+ if (rte->ref == NULL)
+ continue;
if (!strcmp(rte->ref->relname, "*NEW*"))
continue;
if (!strcmp(rte->ref->relname, "*CURRENT*"))
@@ -1274,7 +1281,10 @@ get_rule_expr(Node *node, deparse_context *context)
if (context->varprefix)
{
- if (!strcmp(rte->ref->relname, "*NEW*"))
+ if (rte->ref == NULL)
+ appendStringInfo(buf, "%s.",
+ quote_identifier(rte->relname));
+ else if (!strcmp(rte->ref->relname, "*NEW*"))
appendStringInfo(buf, "new.");
else if (!strcmp(rte->ref->relname, "*CURRENT*"))
appendStringInfo(buf, "old.");