pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Constantin Teodorescu <teo@flex.ro>
To: Marija Fras <mariafra@ac.uma.es>
To: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: Primary Keys and Foreign Keys in PgAccess
Date: Wed, 18 Nov 1998 14:59:51 +0200
Message-ID: <3652C4C7.6A8B5792@flex.ro> (raw)
References: <3652C13F.681E8A72@ac.uma.es>

Marija Fras wrote:
> 
> I just started to use PgAccess (it's 0.86; PostgreSQL 6.3) and it makes
> me wonder how (if) can you say that a field is PRIMARY KEY or FOREIGN
> KEY as a matter of fact. If this can´t be done then isn´t it a bit
> unconvinient?
> Really hope you would care to answer me! Thank´s.

Last stable versions : PgAccess 0.92b ( http://www.flex.ro/pgaccess )
and PostgreSQL 6.4.

PgAccess 0.92b implements primary keys.

In a couple of weeks it would be availabe PostgreSQL 6.4.1 and PgAccess
0.92 final.

PostgreSQL does not implement (yet) foreign keys as language syntax
althought they can be implemented using functions, so PgAccess cannot
operate with them.

There is a simple possibility to force the value of a column to be in
another table with constraints.

Example :

create table students (id int4, name text, primary key(id));
create function is_student(int4) returns bool as 'select count(*) > 0
from students where id = $1' language 'sql';
create table classes (..... , student int4, constraint good_student
check is_student(student));

It works fine!

All the best,

Constantin Teodorescu
FLEX Consulting Braila, ROMANIA



Message-ID: <3652C4C7.6A8B5792@flex.ro>
Permalink:  ../3652C4C7.6A8B5792@flex.ro/
Also on:    postgresql.org/message-id/3652C4C7.6A8B5792@flex.ro

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: teo@flex.ro, mariafra@ac.uma.es
  Subject: Re: Primary Keys and Foreign Keys in PgAccess
  In-Reply-To: <3652C4C7.6A8B5792@flex.ro>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox