pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sad <sad@bankir.ru>
To: pgsql-sql@postgresql.org
Subject: Re: surrogate key or not?
Date: Fri, 23 Jul 2004 09:16:50 +0400
Message-ID: <200407230916.50436.sad@bankir.ru> (raw)
In-Reply-To: <20040722142040.H3720@hermes.hilbert.loc>
References: <1090325769.3241.27.camel@dicaprio.akademie1.de>
	<200407211025.33615.josh@agliodbs.com>
	<20040722142040.H3720@hermes.hilbert.loc>

I want to add some notes

> create table diagnosis (
>     pk serial primary key,
>     fk_patient integer
> 	not null
> 	references patient(pk)
> 	on update cascade
> 	on delete cascade,
>     narrative text
> 	not null,
>     unique(fk_patient, narrative)
> );

1) a sequence generates INT8 values (in general) and you have INT4 field to 
refer to a serial field.

2) narrative TEXT is very bad to check uniquness becauce it is non-formal 
human-generated native-language text. so it contains missprints, it may be 
rephrased many ways with the same meaning.

3) afaik a diagnosis doesn't belong to a patient,
it belongs to a History, and History is marked with a date and status and 
belongs to a patient.

do not treat my words as The Truth. 





view thread (44+ messages)  latest in thread

Message-ID: <200407230916.50436.sad@bankir.ru>
Permalink:  ../200407230916.50436.sad@bankir.ru/
Also on:    postgresql.org/message-id/200407230916.50436.sad@bankir.ru

 · 

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-sql@postgresql.org
  Cc: sad@bankir.ru
  Subject: Re: surrogate key or not?
  In-Reply-To: <200407230916.50436.sad@bankir.ru>

* 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