Gossamer Forum
Home : Products : Gossamer Links : Discussions :

"File handling requires one primary key" message

Quote Reply
"File handling requires one primary key" message
Hi,
in administration in add link form, instead of file input the "File handling requires one primary key" message is displayed.

Should this file-column be a part of primary key?
or
Should the links table have primary key formed only from one column?
Quote Reply
Re: [svalera] "File handling requires one primary key" message In reply to
Hi,

This error means the table you are adding a File column too does not have a primary key defined.

Have you modified the Links table at all? If not, it could be your .def file is corrupted somehow. Try going to Database->Links->Properties and click on Resync Database at the bottom. This will update the .def file with what's in MySQL.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] "File handling requires one primary key" message In reply to
Hi,

In Links table I have one primary key which contain two columns.

But the GT::SQL::Display::HTML::file() routine checks:

Code:
my @pk = $self->{db}->pk(); @pk == 1 or return "File handling requires one primary key";

Can I have primary key with two columns?
Quote Reply
Re: [Alex] "File handling requires one primary key" message In reply to
Hi Alex,

some adds for the previous post:

$self->{db}->pk() return an array with names of columns from primary key, and if a table contain primary key with more than one column we obtain an error here.

What connection is between properties of primary key and file type field?
Quote Reply
Re: [svalera] "File handling requires one primary key" message In reply to
Hi,

Sorry, I missed your earlier reply. No, you should not have a combined primary key on the Links table. You should only have a single primary key fields (ID). Why did you make it combined? A unique index is probably a better idea.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] "File handling requires one primary key" message In reply to
Hi Alex,
thank you for answer,

Ok, it's not quite a standart Links table, it's a table with primary key (ID, Language). I store in it data in multiple languages. I don't want to have Nr_of_fields*Nr_of_Languages columns in the table and that's why I insert Language in the primary key.

On the other hand GT modules can be used not only for Links, and I don't understand why exists this connection ... :)
Quote Reply
Re: [Alex] "File handling requires one primary key" message In reply to
Hi Alex,

I have changed some code and now I can upload files as Links fields but when I have tried to delete/modify files the "Composite Primary Keys not supported" message was deplayed. And I think that this is the answer for all my questions Mad

Last edited by:

svalera: Oct 11, 2002, 2:49 PM