Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: unique constraint on 2 columns


  • From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
  • To: pgsql general <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: unique constraint on 2 columns
  • Date: Fri, 20 Apr 2007 17:56:25 -0400
  • Message-id: <A6DB81FB-0B04-43DF-82AA-207D6C609B4D(at)2xlp(dot)com>


On Apr 20, 2007, at 5:43 PM, Vladimir Zelinski wrote:

This looks like more table design problem than
database limitation.
The one column should accommodate values from both
columns with unique index built on this column. Your
requirements tell me that these values are the same
nature and should be placed in the same column. To
distinguish between them use another column to put an
attribute.

No, both values can be present at once. They're both external facing guids that point to the same resource and serve as keys for the table data. Some rows have one, some have two.

in regards to table desgin solution, if I redid anything it would be something like:
	table_main
		main_id
	table_main_2_guid
		main_id
		guid_id	unique
		context_id

but then i'm using 2 tables and have to join -- which means I need to rewrite evertyhing that queries this table - which is both the core table for my application and supposed to be free of any multi-table queries for simple reads.

so i'm going to try the trigger route.


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|      FindMeOn.com - The cure for Multiple Web Personality Disorder
|      Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|      RoadSound.com - Tools For Bands, Stuff For Fans
|      Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group