Search Postgresql Archives

Re: limit table to one row

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

 



g == gryzman@xxxxxxxxx writes:

 g> If you want to store period of time, why store it as varchar ?

 g> just store two rows
 g> create table foo(
 g>   n varchar,
 g>   val date
 g> );

 g> and store two rows:
 g> "start", now(),
 g> "end", now()+'something '::interval

 g> Wouldn't that do, or is there something I misunderstand ?

Sure, that would work, but I'm having to retrofit this table to an
existing system.  Much of the system I'm redesigning, but this piece
isn't too terribly important right now.

 g> The approach with vertical structure, is used when people want to
 g> store some particular state, say - kind of like structure in C, but in
 g> SQL, and they create table for it with all the columns, etc, and have
 g> to limit it to one row.

 g> On the other hand, you could also use unique index on (1) approach
 g> (say if you need more variety of types).

Got it.

-- 
Brandon

-- 
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