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

Re: pgsql: If an index depends on no columns of its table, give it a

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: If an index depends on no columns of its table, give it a
Date: 2007-11-09 18:41:19
Message-ID: 87hcjvcldc.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-committers
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
>
>> Sure is, and I've done it just a few days ago.
>
>> This SQL does it using standard syntax:
>
>>   create table foo (handle integer primary key check (handle = 1));
>
> That does not constrain the table to have only one row.  It constrains
> it to have only one value of the handle field (thereby making the field
> useless).  

And that field is the primary key so...

I think the point is that both of these solutions are reasonable solutions to
the stated problem. If we can there's no reason to make only one of them
legal.

Actually there is one reason to prefer Simon's solution (which was the only
approach I've seen before) -- it's standard SQL and should work on any
database with check constraints and unique constraints. 

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

In response to

pgsql-committers by date

Next:From: Tom LaneDate: 2007-11-09 20:10:02
Subject: pgsql: Second pass at improving LIKE/regex estimation in non-C locales.
Previous:From: Magnus HaganderDate: 2007-11-09 17:31:07
Subject: pgsql: Add parameter krb_realm used by GSSAPI, SSPI and Kerberos to

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group