Search Postgresql Archives

Re: limit table to one row

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 09 Jun 2009 08:24:01 -0700, Brandon Metcalf <brandon@xxxxxxxxxxxxxxxxxx> wrote:

  CREATE TABLE foo (
    start  DATE,
    length VARCHAR(10),
  );

I need to be able to get one value for each column at any given time.

CREATE UNIQUE INDEX u ON foo ((start IS NOT NULL));

You would just make sure you SELECT FROM foo WHERE start IS NOT NULL;

However, it doesn't prevent you from having 0 rows on the table.


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux