#include "commands/dbcommands.h"
#include "commands/event_trigger.h"
#include "commands/extension.h"
+#include "commands/defrem.h"
#include "commands/tablecmds.h"
#include "parser/parse_utilcmd.h"
{
CreateStmt *stmt;
ListCell *cell;
+ bool with_oids = default_with_oids;
stmt = (CreateStmt *) parsetree;
if (stmt->ofTypename != NULL)
error_unsupported_command("CREATE TABLE ... OF TYPE");
+ /* verify WITH options */
+ foreach(cell, stmt->options)
+ {
+ DefElem *def = (DefElem *) lfirst(cell);
+
+ /* reject WITH OIDS */
+ if (def->defnamespace == NULL &&
+ pg_strcasecmp(def->defname, "oids") == 0)
+ {
+ with_oids = defGetBoolean(def);
+ }
+ }
+
+ if (with_oids)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("Tables WITH OIDs are not supported with bdr")));
+ }
+
+ /* verify table elements */
foreach(cell, stmt->tableElts)
{
Node *element = lfirst(cell);
\d+ test_tbl_inh_*
\c regression
\d+ test_tbl_inh_*
+-- ensure tables WITH OIDs can't be created
+SHOW default_with_oids;
+ default_with_oids
+-------------------
+ off
+(1 row)
+
+CREATE TABLE tbl_with_oids() WITH oids;
+ERROR: Tables WITH OIDs are not supported with bdr
+CREATE TABLE tbl_without_oids() WITHOUT oids;
+DROP TABLE tbl_without_oids;
+CREATE TABLE tbl_without_oids();
+DROP TABLE tbl_without_oids;
+SET default_with_oids = true;
+CREATE TABLE tbl_with_oids();
+ERROR: Tables WITH OIDs are not supported with bdr
+CREATE TABLE tbl_with_oids() WITH OIDS;
+ERROR: Tables WITH OIDs are not supported with bdr
+CREATE TABLE tbl_without_oids() WITHOUT oids;
+DROP TABLE tbl_without_oids;
+SET default_with_oids = false;
--- AGGREGATE ---
\c postgres
CREATE AGGREGATE test_avg (
\c regression
\d+ test_tbl_inh_*
+-- ensure tables WITH OIDs can't be created
+SHOW default_with_oids;
+CREATE TABLE tbl_with_oids() WITH oids;
+CREATE TABLE tbl_without_oids() WITHOUT oids;
+DROP TABLE tbl_without_oids;
+CREATE TABLE tbl_without_oids();
+DROP TABLE tbl_without_oids;
+SET default_with_oids = true;
+CREATE TABLE tbl_with_oids();
+CREATE TABLE tbl_with_oids() WITH OIDS;
+CREATE TABLE tbl_without_oids() WITHOUT oids;
+DROP TABLE tbl_without_oids;
+SET default_with_oids = false;
--- AGGREGATE ---
\c postgres