dbTalk Databases Forums  

unique index considering nulls as equal

comp.databases.postgresql comp.databases.postgresql


Discuss unique index considering nulls as equal in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM






Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #12  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM






Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #13  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM



Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #14  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM



Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #15  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM



Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #16  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM



Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
  #17  
Old   
Thomas Winkler
 
Posts: n/a

Default Re: unique index considering nulls as equal - 06-12-2008 , 03:33 AM



Hi,

Quote:
test=*# create unique index idx_node on node(coalesce(pid,-1),t);

As you can see, you can insert distinct values for the text-field and
NULL in the pid, but no with NULL in the pid and the same text. Helps
that?
THX for your tip. It works great. I just didn't know the way of using
functions in indexes.

Thomas


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.