Integer foreign key types?
Jean-David Beyer
jeandavid8 at verizon.net
Tue Jul 21 07:04:20 EDT 2009
Colin Law wrote:
> Hi
>
> I suppose it is much too late to put in a plea for the foreign keys in
> the database to be integer types rather than character guids? I will
> appologise in advance as no doubt this was discussed ad nauseum long ago.
> I am looking at possibilities for accessing the db via alternative routes
> and some of this would be much easier with integer keys.
>
I do not understand your question. What stops you from defining a database
that has integer foreign keys?
I have a database with a table like this:
CREATE TABLE company (
company_id INTEGER DEFAULT
nextval('company_company_id_seq')
NOT NULL,
PRIMARY KEY (company_id)
) WITHOUT OIDS TABLESPACE stockc;
and all the other tables (except one) are like this:
CREATE TABLE co_name (
FOREIGN KEY (co_name_company_id) REFERENCES company (company_id)
) WITHOUT OIDS TABLESPACE stockd;
(boring other fields and stuff omitted) So almost all my foreign keys are
integer and work just fine.
Are you referring to a particular database where there is a concept of a
guid (and not postgreSQL in general)? I do not even remember a datatype of
character guid. I know only character(n) for fixed-length and character
varying for variable-length, and text.
Could you be more clear what you are talking about?
--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 06:30:01 up 5 days, 20:27, 3 users, load average: 4.11, 4.10, 4.07
More information about the gnucash-user
mailing list