[Catalyst] Constants that refer to rows in a lookup table.

mla maurice.aubrey at gmail.com
Wed May 23 04:14:32 GMT 2007


Bill Moseley wrote:
> On Tue, May 22, 2007 at 05:57:15PM -0700, mla wrote:
>> Consider this change...
>>
>>   create table cart_status (
>>     id      SERIAL PRIMARY KEY,
>>     status  text UNIQUE NOT NULL
>>     name    text NOT NULL,
>>     active  boolean NOT NULL DEFAULT TRUE
>>   );
> 
> Now there's two primary keys...

Which is okay, AFAIK. No problems with multiple candidate keys.

> Yes, that's an idea.  Better use of the database's relationships, but
> it does mean an extra select or join every time I want to fetch
> cart(s) of a specific status.
> 
> Something to think about.

If it's a performance issue then next step could be to fetch all
the status rows at the start and then use the IDs from that as
your "constants."

> Doesn't answer my question about best way to use constants -- but does
> answer how not to use constants. ;)

Sorry.

Maurice



More information about the Catalyst mailing list