pgsql-server/src/backend/utils/adt ruleutils.c

Поиск
Список
Период
Сортировка
Искать

pgsql-server/src/backend/utils/adt ruleutils.c

От:
momjian@svr1.postgresql.org (Bruce Momjian)
Дата:
CVSROOT:	/cvsroot
Module name:	pgsql-server
Changes by:	momjian@svr1.postgresql.org	03/09/29 15:55:56

Modified files:
	src/backend/utils/adt: ruleutils.c 

Log message:
	The brackets aren't put on the CHECK constraints properly.
	
	Before patch:
	
	test=# select pg_get_constraintdef(oid) from pg_constraint;
	pg_get_constraintdef
	-------------------------------------------------------------------------------------------------
	CHECK (VALUE >= 0)
	CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR
	((a)::text = 'dfd'::text))
	PRIMARY KEY (b)
	FOREIGN KEY (a) REFERENCES test2(b)
	UNIQUE (b)
	(5 rows)
	
	test=# select pg_get_constraintdef(oid, true) from pg_constraint;
	pg_get_constraintdef
	-----------------------------------------------------------------------------------
	CHECK VALUE >= 0
	CHECK a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text =
	'dfd'::text
	PRIMARY KEY (b)
	FOREIGN KEY (a) REFERENCES test2(b)
	UNIQUE (b)
	(5 rows)
	
	After patch:
	
	test=# select pg_get_constraintdef(oid) from pg_constraint;
	pg_get_constraintdef
	-------------------------------------------------------------------------------------------------
	CHECK (VALUE >= 0)
	CHECK ((((a)::text = 'asdf'::text) OR ((a)::text = 'fdsa'::text)) OR
	((a)::text = 'dfd'::text))
	PRIMARY KEY (b)
	FOREIGN KEY (a) REFERENCES test2(b)
	UNIQUE (b)
	(5 rows)
	
	test=# select pg_get_constraintdef(oid, true) from pg_constraint;
	pg_get_constraintdef
	-----------------------------------------------------------------------------------
	CHECK (VALUE >= 0)
	
	`  CHECK (a::text = 'asdf'::text OR a::text = 'fdsa'::text OR a::text =
	'dfd'::text)
	PRIMARY KEY (b)
	FOREIGN KEY (a) REFERENCES test2(b)
	UNIQUE (b)
	(5 rows)
	
	It's important that those brackets are there to (a) match all other
	constraints and (b) so that people can just copy and paste them and it
	will work as SQL.
	
	Christopher Kings-Lynne

FAQ