Stephane Bortzmeyer wrote:
On Wed, Apr 27, 2005 at 04:50:23PM +0200,
Sebastian Böck <sebastianboeck@xxxxxxxxxx> wrote
a message of 48 lines which said:
CREATE UNIQUE INDEX na ON x (name, address) WHERE address IS NULL;
No, because it prevents two tuples with the same value of "name".
Ahh, sorry! Ment something more like:
CREATE TABLE table x (
name TEXT NOT NULL,
address INET
);
CREATE UNIQUE INDEX na ON x (name, address);
CREATE UNIQUE INDEX n ON x (name) WHERE address IS NULL;
HTH
Sebastian
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match