Tables with oid

Started by Fandarelover 27 years ago1 messagesgeneral
Jump to latest
#1Fandarel
fandarel@mail.solisys.com

I'm having some trouble using tables with oids:

I created a table using the following command:
CREATE TABLE registry_blob_t (
registry_key varchar(1024) NOT NULL,
registry_value oid NOT NULL
);

I then tried to insert a value to it using the DBD::Pg interface for perl:
$dbh->do("INSERT INTO registry_blob_t (registry_key, registry_value)
VALUES (user.bob.name.middle, lo_import('/path/file_name') )");

where /path is the path to the file and /file_name is the name of the
file with my data to insert.

I got back this error:
"ERROR: user: Table does not exist."

I tried changing "registry_key" to "thing" to see what happened and I got:
"ERROR: Relation registry_blob_t does not have attribute thing"
so, it can find the table when the sql statement is wrong.

I checked the example for blobs that came with DBD::Pg and used all of
the same code except where the example had an id field of int4 I created
one with varchar(1024). I got the same error so I tried changing the id
field to int4 and it worked.

Can a table with oids deal with varchar(x)'s or can I just not reference
values to keys of type varchar(x)?

At this point, I'll have to do a workaround with an extra table
referencing my varchar(x) key to the int4 key that the table seems to
need.

Thanks,
Matt Vanderpol