[Catalyst] Using Catalyst on MS SQL DB that has tables with no
primary keys
Will Crawford
billcrawford1970 at gmail.com
Mon Sep 17 09:55:42 GMT 2012
On 15 September 2012 03:38, Darren Duncan <darren at darrenduncan.net> wrote:
> Brian Katzung wrote:
>>
>> If I recall correctly, I read in a cookbook somewhere (can't seem to find
>> it now) that for rows with no primary key, you can use:
>>
>> __PACKAGE__->set_primary_key(__PACKAGE__->columns);
>>
>> (making the entire row be a multi-column primary key).
>
>
> Well that is indeed how things should work; when there is no primary or
> unique key explicitly defined, there should be an implicit one ranging over
> all the columns. However, SQL doesn't work that way and would allow
> duplicate rows, and so then the question is what behavior do you expect your
> Perl layer to have? If you edit a duplicate row, is it supposed to change
> all copies or just one? -- Darren Duncan
It might be worth finding out (or, I guess you already will know) if
it's safe to delete any duplicate rows; that might render the final
question there moot :)
Certainly Brian's suggestion is quite an elegant way to do what must be done.
More information about the Catalyst
mailing list