summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/heap.c24
-rw-r--r--src/backend/parser/parse_expr.c23
-rw-r--r--src/backend/parser/parse_func.c97
-rw-r--r--src/backend/pgxc/pool/postgresql_fdw.c5
-rw-r--r--src/backend/tcop/utility.c44
-rw-r--r--src/include/parser/parse_expr.h4
-rw-r--r--src/include/parser/parse_func.h3
-rw-r--r--src/test/regress/expected/dependency_1.out2
-rw-r--r--src/test/regress/expected/domain_1.out7
-rw-r--r--src/test/regress/expected/uuid_1.out153
-rw-r--r--src/test/regress/output/constraints_1.source218
11 files changed, 192 insertions, 388 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index ed08015d9c..00d12e05e1 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -80,6 +80,8 @@
#include "catalog/pgxc_class.h"
#include "catalog/pgxc_node.h"
#include "pgxc/locator.h"
+#include "pgxc/pgxc.h"
+#include "pgxc/postgresql_fdw.h"
#endif
@@ -2729,28 +2731,6 @@ cookDefault(ParseState *pstate,
Assert(raw_default != NULL);
-#ifdef PGXC
- /*
- * Block use of non-immutable functions as DEFAULT.
- *
- * Support of nextval(), currval(), now() as DEFAULT value in XC needs a special support
- * like SERIAL, so block it for the time being
- *
- * PGXCTODO: As possible implementation, a constraint with non-immutable functions
- * is just created on Coordinator and when an INSERT query needs a default value
- * Coordinator feeds it, rewrite the query, and distributes it to Datanodes
- *
- * Sequence (currval, nextval) and timestamp values (now()...) have
- * to be taken from GTM.
- */
- if (IsA(raw_default,FuncCall))
- if (!IsFuncImmutable(pstate, (FuncCall *) raw_default))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("Postgres-XC does not support DEFAULT with non-immutable functions yet"),
- errdetail("The feature is not currently supported")));
-#endif
-
/*
* Transform raw parsetree to executable expression.
*/
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 125bfd5eff..fe66137280 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -1248,29 +1248,6 @@ transformFuncCall(ParseState *pstate, FuncCall *fn)
fn->location);
}
-#ifdef PGXC
-/*
- * IsFuncImmutable
- *
- * Check if given function is immutable or not
- * based on the function name and on its arguments
- */
-bool
-IsFuncImmutable(ParseState *pstate, FuncCall *fn)
-{
- ListCell *args;
- List *targs = NIL;
-
- /* Transform list of arguments */
- foreach(args, fn->args)
- {
- targs = lappend(targs, transformExpr(pstate,
- (Node *) lfirst(args)));
- }
-
- return IsParseFuncImmutable(pstate, targs, fn->funcname, fn->func_variadic);
-}
-#endif
static Node *
transformCaseExpr(ParseState *pstate, CaseExpr *c)
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index cfa3f5179f..75f1e20475 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -1619,100 +1619,3 @@ LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError)
return oid;
}
-
-
-#ifdef PGXC
-/*
- * IsParseFuncImmutable
- *
- * Check if given function is immutable or not
- * based on the function name and on its arguments
- * This functionnality will be extended to support functions in constraints
- */
-bool
-IsParseFuncImmutable(ParseState *pstate, List *targs, List *funcname, bool func_variadic)
-{
- ListCell *l;
- ListCell *nextl;
- FuncDetailCode fdresult;
- Oid actual_arg_types[FUNC_MAX_ARGS];
- List *argnames;
- int nargs;
- /* Return results */
- Oid funcid, rettype;
- Oid *declared_arg_types;
- bool retset;
- int nvargs;
- List *argdefaults;
-
- /* Get detailed argument information */
- nargs = 0;
- for (l = list_head(targs); l != NULL; l = nextl)
- {
- Node *arg = lfirst(l);
- Oid argtype = exprType(arg);
-
- nextl = lnext(l);
-
- if (argtype == VOIDOID && IsA(arg, Param))
- {
- targs = list_delete_ptr(targs, arg);
- continue;
- }
- actual_arg_types[nargs++] = argtype;
- }
- argnames = NIL;
-
- foreach(l, targs)
- {
- Node *arg = lfirst(l);
-
- if (IsA(arg, NamedArgExpr))
- {
- NamedArgExpr *na = (NamedArgExpr *) arg;
- ListCell *lc;
-
- /* Reject duplicate arg names */
- foreach(lc, argnames)
- {
- if (strcmp(na->name, (char *) lfirst(lc)) == 0)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("argument name \"%s\" used more than once",
- na->name),
- parser_errposition(pstate, na->location)));
- }
- argnames = lappend(argnames, na->name);
- }
- else
- {
- if (argnames != NIL)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("positional argument cannot follow named argument"),
- parser_errposition(pstate, exprLocation(arg))));
- }
- }
-
- fdresult = func_get_detail(funcname,
- targs,
- argnames,
- nargs,
- actual_arg_types,
- !func_variadic,
- true,
- &funcid, &rettype, &retset, &nvargs,
- &declared_arg_types, &argdefaults);
-
- /*
- * Now only the function ID is used to check if function is immutable or not,
- * but for function support in DEFAULT values, this function can be easily extended
- * for other analysis purposes.
- */
- if (func_volatile(funcid) == PROVOLATILE_IMMUTABLE)
- return true;
- else
- return false;
-}
-#endif
-
diff --git a/src/backend/pgxc/pool/postgresql_fdw.c b/src/backend/pgxc/pool/postgresql_fdw.c
index 0a42426ab0..2aef35632b 100644
--- a/src/backend/pgxc/pool/postgresql_fdw.c
+++ b/src/backend/pgxc/pool/postgresql_fdw.c
@@ -20,6 +20,7 @@
#include "nodes/nodeFuncs.h"
#include "nodes/makefuncs.h"
#include "optimizer/clauses.h"
+#include "optimizer/planmain.h"
#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
@@ -143,7 +144,11 @@ foreign_qual_walker(Node *node, foreign_qual_context *context)
* foreign server . It is not necessary to worry about oprrest
* and oprjoin here because they are invoked by planner but not
* executor. DistinctExpr is a typedef of OpExpr.
+ * We need also to be sure that function id is correctly set
+ * before evaluation.
*/
+ set_opfuncid((OpExpr *) node);
+
if (!is_immutable_func(((OpExpr*) node)->opfuncid))
return true;
break;
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index ee619b21dd..5194af279c 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -1258,8 +1258,7 @@ standard_ProcessUtility(Node *parsetree,
/* Launch GRANT on Coordinator if object is a sequence */
if ((stmt->objtype == ACL_OBJECT_RELATION &&
- stmt->targtype == ACL_TARGET_OBJECT) ||
- stmt->objtype == ACL_OBJECT_SEQUENCE)
+ stmt->targtype == ACL_TARGET_OBJECT))
{
/*
* In case object is a relation, differenciate the case
@@ -1289,7 +1288,7 @@ standard_ProcessUtility(Node *parsetree,
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("PGXC does not support GRANT on multiple object types"),
- errdetail("Grant VIEW/SEQUENCE/TABLE with separate queries")));
+ errdetail("Grant VIEW/TABLE with separate queries")));
}
}
}
@@ -1510,14 +1509,14 @@ standard_ProcessUtility(Node *parsetree,
#ifdef PGXC
if (IS_PGXC_COORDINATOR)
{
- /*
- * If sequence is temporary, no need to send this query to other
- * remote Coordinators.
- */
CreateSeqStmt *stmt = (CreateSeqStmt *) parsetree;
+ bool is_temp = stmt->sequence->relpersistence == RELPERSISTENCE_TEMP;
- if (stmt->sequence->relpersistence != RELPERSISTENCE_TEMP)
- ExecUtilityStmtOnNodes(queryString, NULL, false, EXEC_ON_COORDS, false);
+ /* Set temporary object flag in pooler */
+ if (is_temp)
+ PoolManagerSetCommand(POOL_CMD_TEMP, NULL);
+
+ ExecUtilityStmtOnNodes(queryString, NULL, false, EXEC_ON_ALL_NODES, is_temp);
}
#endif
break;
@@ -1527,15 +1526,15 @@ standard_ProcessUtility(Node *parsetree,
#ifdef PGXC
if (IS_PGXC_COORDINATOR)
{
- /*
- * If sequence is temporary, no need to send this query to other
- * remote Coordinators.
- */
AlterSeqStmt *stmt = (AlterSeqStmt *) parsetree;
- Oid relid = RangeVarGetRelid(stmt->sequence, false);
+ bool is_temp;
+ RemoteQueryExecType exec_type;
- if (!IsTempSequence(relid))
- ExecUtilityStmtOnNodes(queryString, NULL, false, EXEC_ON_COORDS, false);
+ exec_type = ExecUtilityFindNodes(OBJECT_SEQUENCE,
+ RangeVarGetRelid(stmt->sequence, false),
+ &is_temp);
+
+ ExecUtilityStmtOnNodes(queryString, NULL, false, exec_type, is_temp);
}
#endif
break;
@@ -2168,11 +2167,8 @@ ExecUtilityFindNodes(ObjectType object_type,
switch (object_type)
{
case OBJECT_SEQUENCE:
- /* Check if object is a temporary sequence */
- if ((*is_temp = IsTempSequence(relid)))
- exec_type = EXEC_ON_NONE;
- else
- exec_type = EXEC_ON_COORDS;
+ *is_temp = IsTempTable(relid);
+ exec_type = EXEC_ON_ALL_NODES;
break;
case OBJECT_TABLE:
@@ -2220,10 +2216,8 @@ ExecUtilityFindNodesRelkind(Oid relid, bool *is_temp)
switch (relkind_str)
{
case RELKIND_SEQUENCE:
- if ((*is_temp = IsTempSequence(relid)))
- exec_type = EXEC_ON_NONE;
- else
- exec_type = EXEC_ON_COORDS;
+ *is_temp = IsTempTable(relid);
+ exec_type = EXEC_ON_ALL_NODES;
break;
case RELKIND_RELATION:
diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h
index 56b1b4284d..f3edf702ec 100644
--- a/src/include/parser/parse_expr.h
+++ b/src/include/parser/parse_expr.h
@@ -19,8 +19,4 @@
extern bool Transform_null_equals;
extern Node *transformExpr(ParseState *pstate, Node *expr);
-#ifdef PGXC
-extern bool IsFuncImmutable(ParseState *pstate, FuncCall *fn);
-#endif
-
#endif /* PARSE_EXPR_H */
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index 05e88968a6..d28c473ebe 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -83,7 +83,4 @@ extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes,
bool noError);
extern void check_pg_get_expr_args(ParseState *pstate, Oid fnoid, List *args);
-#ifdef PGXC
-extern bool IsParseFuncImmutable(ParseState *pstate, List *fn_args, List *funcname, bool func_variadic);
-#endif
#endif /* PARSE_FUNC_H */
diff --git a/src/test/regress/expected/dependency_1.out b/src/test/regress/expected/dependency_1.out
index 827f442672..eeb2a1c110 100644
--- a/src/test/regress/expected/dependency_1.out
+++ b/src/test/regress/expected/dependency_1.out
@@ -102,8 +102,6 @@ CREATE TABLE deptest2 (f1 int);
-- make a serial column the hard way
CREATE SEQUENCE ss1;
ALTER TABLE deptest2 ALTER f1 SET DEFAULT nextval('ss1');
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
ALTER SEQUENCE ss1 OWNED BY deptest2.f1;
RESET SESSION AUTHORIZATION;
REASSIGN OWNED BY regression_user1 TO regression_user2;
diff --git a/src/test/regress/expected/domain_1.out b/src/test/regress/expected/domain_1.out
index f2f45379d6..e3a6127396 100644
--- a/src/test/regress/expected/domain_1.out
+++ b/src/test/regress/expected/domain_1.out
@@ -246,8 +246,6 @@ create domain ddef2 oid DEFAULT '12';
create domain ddef3 text DEFAULT 5;
create sequence ddef4_seq;
create domain ddef4 int4 DEFAULT nextval('ddef4_seq');
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
create domain ddef5 numeric(8,2) NOT NULL DEFAULT '12.12';
create table defaulttest
( col1 ddef1
@@ -259,9 +257,7 @@ create table defaulttest
, col7 ddef4 DEFAULT 8000
, col8 ddef5
);
-ERROR: type "ddef4" does not exist
-LINE 5: , col4 ddef4 PRIMARY KEY
- ^
+ERROR: Column col4 is not a hash distributable data type
insert into defaulttest(col4) values(0); -- fails, col5 defaults to null
ERROR: relation "defaulttest" does not exist
LINE 1: insert into defaulttest(col4) values(0);
@@ -410,7 +406,6 @@ drop domain ddef1 restrict;
drop domain ddef2 restrict;
drop domain ddef3 restrict;
drop domain ddef4 restrict;
-ERROR: type "ddef4" does not exist
drop domain ddef5 restrict;
drop sequence ddef4_seq;
-- Test domains over domains
diff --git a/src/test/regress/expected/uuid_1.out b/src/test/regress/expected/uuid_1.out
index 39ea1e952d..982f1dd7b2 100644
--- a/src/test/regress/expected/uuid_1.out
+++ b/src/test/regress/expected/uuid_1.out
@@ -5,147 +5,144 @@ CREATE TABLE guid1
guid_field UUID,
text_field TEXT DEFAULT(now())
);
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
CREATE TABLE guid2
(
guid_field UUID,
text_field TEXT DEFAULT(now())
);
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
-- inserting invalid data tests
-- too long
INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111F');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "11111111-1111-1111-1111-111111111111F"
LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111...
- ^
+ ^
-- too short
INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-1111-11111111111}');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "{11111111-1111-1111-1111-11111111111}"
LINE 1: INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-11...
- ^
+ ^
-- valid data but invalid format
INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-1111-111111111111');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "111-11111-1111-1111-1111-111111111111"
LINE 1: INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-11...
- ^
+ ^
INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222 ');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "{22222222-2222-2222-2222-222222222222 "
LINE 1: INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-22...
- ^
+ ^
-- invalid data
INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G111-111111111111');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "11111111-1111-1111-G111-111111111111"
LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G11...
- ^
+ ^
INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-1111-111111111111');
-ERROR: relation "guid1" does not exist
+ERROR: invalid input syntax for uuid: "11+11111-1111-1111-1111-111111111111"
LINE 1: INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-111...
- ^
+ ^
--inserting three input formats
INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111');
-ERROR: relation "guid1" does not exist
-LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111...
- ^
INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}');
-ERROR: relation "guid1" does not exist
-LINE 1: INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-22...
- ^
INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e');
-ERROR: relation "guid1" does not exist
-LINE 1: INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a303938373635...
- ^
-- retrieving the inserted data
SELECT guid_field FROM guid1 ORDER BY guid_field;
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field;
- ^
+ guid_field
+--------------------------------------
+ 11111111-1111-1111-1111-111111111111
+ 22222222-2222-2222-2222-222222222222
+ 3f3e3c3b-3a30-3938-3736-353433a2313e
+(3 rows)
+
-- ordering test
SELECT guid_field FROM guid1 ORDER BY guid_field ASC;
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field ASC;
- ^
+ guid_field
+--------------------------------------
+ 11111111-1111-1111-1111-111111111111
+ 22222222-2222-2222-2222-222222222222
+ 3f3e3c3b-3a30-3938-3736-353433a2313e
+(3 rows)
+
SELECT guid_field FROM guid1 ORDER BY guid_field DESC;
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field DESC;
- ^
+ guid_field
+--------------------------------------
+ 3f3e3c3b-3a30-3938-3736-353433a2313e
+ 22222222-2222-2222-2222-222222222222
+ 11111111-1111-1111-1111-111111111111
+(3 rows)
+
-- = operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field = '3f3e3c3b-3a30-3938-3736-353433a2313e';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field = '3f3e3c3b-3a30...
- ^
+ count
+-------
+ 1
+(1 row)
+
-- <> operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field <> '11111111111111111111111111111111';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field <> '111111111111...
- ^
+ count
+-------
+ 2
+(1 row)
+
-- < operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field < '22222222-2222-2222-2222-222222222222';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field < '22222222-2222...
- ^
+ count
+-------
+ 1
+(1 row)
+
-- <= operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field <= '22222222-2222-2222-2222-222222222222';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field <= '22222222-222...
- ^
+ count
+-------
+ 2
+(1 row)
+
-- > operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field > '22222222-2222-2222-2222-222222222222';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field > '22222222-2222...
- ^
+ count
+-------
+ 1
+(1 row)
+
-- >= operator test
SELECT COUNT(*) FROM guid1 WHERE guid_field >= '22222222-2222-2222-2222-222222222222';
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field >= '22222222-222...
- ^
+ count
+-------
+ 2
+(1 row)
+
-- btree and hash index creation test
CREATE INDEX guid1_btree ON guid1 USING BTREE (guid_field);
-ERROR: relation "guid1" does not exist
CREATE INDEX guid1_hash ON guid1 USING HASH (guid_field);
-ERROR: relation "guid1" does not exist
-- unique index test
CREATE UNIQUE INDEX guid1_unique_BTREE ON guid1 USING BTREE (guid_field);
-ERROR: relation "guid1" does not exist
+ERROR: Unique index of partitioned table must contain the hash/modulo distribution column.
-- should fail
INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111');
-ERROR: relation "guid1" does not exist
-LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111...
- ^
-- check to see whether the new indexes are actually there
SELECT count(*) FROM pg_class WHERE relkind='i' AND relname LIKE 'guid%';
count
-------
- 0
+ 2
(1 row)
-- populating the test tables with additional records
INSERT INTO guid1(guid_field) VALUES('44444444-4444-4444-4444-444444444444');
-ERROR: relation "guid1" does not exist
-LINE 1: INSERT INTO guid1(guid_field) VALUES('44444444-4444-4444-444...
- ^
INSERT INTO guid2(guid_field) VALUES('11111111-1111-1111-1111-111111111111');
-ERROR: relation "guid2" does not exist
-LINE 1: INSERT INTO guid2(guid_field) VALUES('11111111-1111-1111-111...
- ^
INSERT INTO guid2(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}');
-ERROR: relation "guid2" does not exist
-LINE 1: INSERT INTO guid2(guid_field) VALUES('{22222222-2222-2222-22...
- ^
INSERT INTO guid2(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e');
-ERROR: relation "guid2" does not exist
-LINE 1: INSERT INTO guid2(guid_field) VALUES('3f3e3c3b3a303938373635...
- ^
-- join test
SELECT COUNT(*) FROM guid1 g1 INNER JOIN guid2 g2 ON g1.guid_field = g2.guid_field;
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 g1 INNER JOIN guid2 g2 ON g1.guid...
- ^
+ count
+-------
+ 4
+(1 row)
+
SELECT COUNT(*) FROM guid1 g1 LEFT JOIN guid2 g2 ON g1.guid_field = g2.guid_field WHERE g2.guid_field IS NULL;
-ERROR: relation "guid1" does not exist
-LINE 1: SELECT COUNT(*) FROM guid1 g1 LEFT JOIN guid2 g2 ON g1.guid_...
- ^
+ count
+-------
+ 1
+(1 row)
+
-- clean up
DROP TABLE guid1, guid2 CASCADE;
-ERROR: table "guid1" does not exist
diff --git a/src/test/regress/output/constraints_1.source b/src/test/regress/output/constraints_1.source
index bd04188535..e6af9d80f5 100644
--- a/src/test/regress/output/constraints_1.source
+++ b/src/test/regress/output/constraints_1.source
@@ -30,28 +30,19 @@ SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f;
CREATE SEQUENCE DEFAULT_SEQ;
CREATE TABLE DEFAULTEXPR_TBL (i1 int DEFAULT 100 + (200-199) * 2,
i2 int DEFAULT nextval('default_seq'));
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2);
-ERROR: relation "defaultexpr_tbl" does not exist
-LINE 1: INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2);
- ^
INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3);
-ERROR: relation "defaultexpr_tbl" does not exist
-LINE 1: INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3);
- ^
INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4);
-ERROR: relation "defaultexpr_tbl" does not exist
-LINE 1: INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4);
- ^
INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL);
-ERROR: relation "defaultexpr_tbl" does not exist
-LINE 1: INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL);
- ^
SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2;
-ERROR: relation "defaultexpr_tbl" does not exist
-LINE 1: SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2;
- ^
+ four | i1 | i2
+------+-----+----
+ | -3 | 1
+ | -1 | -2
+ | 102 | -4
+ | 102 |
+(4 rows)
+
-- syntax errors
-- test for extraneous comma
CREATE TABLE error_tbl (i int DEFAULT (100, ));
@@ -120,16 +111,13 @@ CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'),
z INT DEFAULT -1 * currval('insert_seq'),
CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8),
CHECK (x + z = 0));
-ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet
-DETAIL: The feature is not currently supported
INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(x,z) VALUES (2, -2);
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z;
- ^
+ zero | x | y | z
+------+---+---+---
+(0 rows)
+
SELECT 'one' AS one, nextval('insert_seq');
one | nextval
-----+---------
@@ -137,173 +125,147 @@ SELECT 'one' AS one, nextval('insert_seq');
(1 row)
INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y');
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y');
- ^
INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(x,z) VALUES (1, -2);
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check"
INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7);
- ^
INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5);
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7);
- ^
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
- ^
SELECT '' AS four, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS four, * FROM INSERT_TBL order by x,y,z;
- ^
+ four | x | y | z
+------+---+---------------+----
+ | 3 | Y | -3
+ | 4 | -!NULL- | -4
+ | 7 | !check failed | -7
+ | 7 | -NULL- | -7
+(4 rows)
+
INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4);
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_tbl_check"
INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed');
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed');
- ^
INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-');
- ^
SELECT '' AS six, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS six, * FROM INSERT_TBL order by x,y,z;
- ^
+ six | x | y | z
+-----+---+---------------+----
+ | 3 | Y | -3
+ | 4 | -!NULL- | -4
+ | 5 | !check failed | -5
+ | 6 | -!NULL- | -6
+ | 7 | !check failed | -7
+ | 7 | -NULL- | -7
+(6 rows)
+
SELECT 'seven' AS one, nextval('insert_seq');
one | nextval
-------+---------
- seven | 2
+ seven | 7
(1 row)
INSERT INTO INSERT_TBL(y) VALUES ('Y');
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y');
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
SELECT 'eight' AS one, currval('insert_seq');
one | currval
-------+---------
- eight | 2
+ eight | 8
(1 row)
-- According to SQL92, it is OK to insert a record that gives rise to NULL
-- constraint-condition results. Postgres used to reject this, but it
-- was wrong:
INSERT INTO INSERT_TBL VALUES (null, null, null);
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL VALUES (null, null, null);
- ^
SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z;
- ^
+ nine | x | y | z
+------+---+---------------+----
+ | 3 | Y | -3
+ | 4 | -!NULL- | -4
+ | 5 | !check failed | -5
+ | 6 | -!NULL- | -6
+ | 7 | !check failed | -7
+ | 7 | -NULL- | -7
+ | | |
+(7 rows)
+
--
-- Check inheritance of defaults and constraints
--
CREATE TABLE INSERT_CHILD (cx INT default 42,
cy INT CHECK (cy > x))
INHERITS (INSERT_TBL);
-ERROR: relation "insert_tbl" does not exist
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
-ERROR: relation "insert_child" does not exist
-LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11);
- ^
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
-ERROR: relation "insert_child" does not exist
-LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6);
- ^
+ERROR: new row for relation "insert_child" violates check constraint "insert_child_check"
INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7);
-ERROR: relation "insert_child" does not exist
-LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7);
- ^
+ERROR: new row for relation "insert_child" violates check constraint "insert_tbl_check"
INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7);
-ERROR: relation "insert_child" does not exist
-LINE 1: INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',...
- ^
+ERROR: new row for relation "insert_child" violates check constraint "insert_con"
SELECT * FROM INSERT_CHILD order by 1,2,3;
-ERROR: relation "insert_child" does not exist
-LINE 1: SELECT * FROM INSERT_CHILD order by 1,2,3;
- ^
+ x | y | z | cx | cy
+---+--------+----+----+----
+ 7 | -NULL- | -7 | 42 | 11
+(1 row)
+
DROP TABLE INSERT_CHILD;
-ERROR: table "insert_child" does not exist
--
-- Check constraints on INSERT INTO
--
DELETE FROM INSERT_TBL;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: DELETE FROM INSERT_TBL;
- ^
ALTER SEQUENCE INSERT_SEQ RESTART WITH 4;
CREATE TABLE tmp (xd INT, yd TEXT, zd INT);
INSERT INTO tmp VALUES (null, 'Y', null);
INSERT INTO tmp VALUES (5, '!check failed', null);
INSERT INTO tmp VALUES (null, 'try again', null);
INSERT INTO INSERT_TBL(y) select yd from tmp;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y) select yd from tmp;
- ^
SELECT '' AS three, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS three, * FROM INSERT_TBL order by x,y,z;
- ^
+ three | x | y | z
+-------+---+---------------+----
+ | 4 | Y | -4
+ | 5 | !check failed | -5
+ | 6 | try again | -6
+(3 rows)
+
INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again';
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try aga...
- ^
INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again';
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd ...
- ^
INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again';
-ERROR: relation "insert_tbl" does not exist
-LINE 1: INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd ...
- ^
+ERROR: new row for relation "insert_tbl" violates check constraint "insert_con"
SELECT '' AS four, * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT '' AS four, * FROM INSERT_TBL order by x,y,z;
- ^
+ four | x | y | z
+------+---+---------------+----
+ | 4 | Y | -4
+ | 5 | !check failed | -5
+ | 6 | try again | -6
+ | 7 | try again | -7
+ | | try again |
+ | | try again |
+(6 rows)
+
DROP TABLE tmp;
--
-- Check constraints on UPDATE
--
UPDATE INSERT_TBL SET x = NULL WHERE x = 5;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: UPDATE INSERT_TBL SET x = NULL WHERE x = 5;
- ^
+ERROR: Partition column can't be updated in current version
UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: UPDATE INSERT_TBL SET x = 6 WHERE x = 6;
- ^
+ERROR: Partition column can't be updated in current version
UPDATE INSERT_TBL SET x = -z, z = -x;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: UPDATE INSERT_TBL SET x = -z, z = -x;
- ^
+ERROR: Partition column can't be updated in current version
UPDATE INSERT_TBL SET x = z, z = x;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: UPDATE INSERT_TBL SET x = z, z = x;
- ^
+ERROR: Partition column can't be updated in current version
SELECT * FROM INSERT_TBL order by x,y,z;
-ERROR: relation "insert_tbl" does not exist
-LINE 1: SELECT * FROM INSERT_TBL order by x,y,z;
- ^
+ x | y | z
+---+---------------+----
+ 4 | Y | -4
+ 5 | !check failed | -5
+ 6 | try again | -6
+ 7 | try again | -7
+ | try again |
+ | try again |
+(6 rows)
+
-- DROP TABLE INSERT_TBL;
--
-- Check constraints on COPY FROM