[GENERAL] how to create data on the fly?

2012-02-28 Thread bboett
Hello!

i am again struggling with a problem i am unsure how to set up. I could
easily solve all in the php backend, but this would impede further extensions
and doesn't satisfy my curiosity :D

so, here's the problem: a patient takes everyday a medecine, and from time to
time comes in a result of a blood-sample.

Now i first of all, i want to draw a graph showing the dosis taken, and the
blood-values mesured. Later on i want to calculate the assimilation rate, the
saturation rate, and the effective rate, both in real, and prognosis

My actual problem beeing that the dosis may be not simply 1 to n pills per day,
   but for example day 1 1, day 2 1.25, day 3 .5, day 4 1, etc... the most
   complex case to now i, has a period over 4 days

so i set up:

CREATE TABLE patients (
id integer NOT NULL,
name text,
minzone real,
maxzone real,
refresh integer
);

CREATE TABLE inrdata (
id integer NOT NULL,
temps timestamp without time zone,
patid integer,
inr real
);

CREATE TABLE posologie (
id integer NOT NULL,
inrid integer,
champ text,
definition text,
valeur real
);


In  patients i have the persons name, and the boundaries that are wanted for
the blood-sample value, in inrdata i have the timepoints where i get a
blood-sample-result, and i eventually adjust the posology.

in posologie i have the table at a timepoint i have stored at the moment in
champ=sequence, definition=1;1.25;0.5;1, 

and actually i solve the problem with the frontend

what i would like is to store the posology iterations in the posology table,
 and be able to make a select that generates  the data on the fly. Taking
 the different waypoints given by the data in inrdata as starting point
 and computing for each day the actual dosis

but i have no idea how to do this in sql?

any help appreciated!


ciao Bruno
==
bbo...@adlp.org

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] How to typecast an integer into a timestamp?

2012-01-27 Thread bboett
Hello!

again quite a stupid problem i regularly run into
and that i still haven't solved yet...

again i used a type timestamp to keep a track of modification time, and again 
it gets stupid and confusing.

first of all the errors are labeled as timestamp without timezone, i only 
specified timestamp

the data was created as a timestamp with php-mktime, but when sending to the 
database postgres complains that its an int, and when i try to typecast it, 
(with the ::timestamp appendix to the value), that its not possible to convert 
an int to a timestamp (without timezone) .

so as usual i would discard the timezone datatype and alter the table to use 
integer instead, but this time i am wondering, since this datatype is present, 
there's surely a way to use it properly? but how?

please enlighten me!

ciao
Bruno

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] help... lost database after upgrade from 9.0 to 9.1

2012-01-04 Thread bboett
Hello!  



just made a stupid move... upgraded a working system and without

checking if the backup was ok   



so i end up with a debian system having upgraded to 9,1 without 

converting the database, and a scrambled backup which is totally

unusable



i tried to start the old tree with  

pg_ctlcluster 9.0 main start

Error: could not exec   start -D /var/lib/postgresql/9.0/main -l

+/var/log/postgresql/postgresql-9.0-main.log -s -o  -c  

+config_file=/etc/postgresql/9.0/main/postgresql.conf :   





so i tried to copy the old 9.0 tree to a machine with a still working 9,0   

postgres, but it stops with 

Starting PostgreSQL 9.0 database server: mainError: could not exec  

/usr/lib/postgresql/9.0/bin/pg_ctl /usr/lib/postgresql/9.0/bin/pg_ctl   

start -D /var/lib/postgresql/9.0/main -l

/var/log/postgresql/postgresql-9.0-main.log -s -o -c

config_file=/etc/postgresql/9.0/main/postgresql.conf : ... failed!

 failed!


so what can i do to extract the data of that tree and feed it into the  
   
 9.1 tree?  



 thanks in avance!
-- 
ciao bboett
==
bbo...@adlp.org
http://inforezo.u-strasbg.fr/~bboett/
===

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] delayed post: Subject: help... lost database after upgrade from 9.0 to 9.1

2012-01-04 Thread bboett
Hello,

  got a delaying message for my post because i visibly send from the
  wrong machine, tryed (hopefully) from the right one to resend it

-- 
ciao bboett
==
bbo...@adlp.org
http://inforezo.u-strasbg.fr/~bboett/
===

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] help... lost database after upgrade from 9.0 to 9.1

2012-01-04 Thread bboett
Hello!  



just made a stupid move... upgraded a working system and without

checking if the backup was ok   



so i end up with a debian system having upgraded to 9,1 without 

converting the database, and a scrambled backup which is totally

unusable



i tried to start the old tree with  

pg_ctlcluster 9.0 main start

Error: could not exec   start -D /var/lib/postgresql/9.0/main -l

+/var/log/postgresql/postgresql-9.0-main.log -s -o  -c  

+config_file=/etc/postgresql/9.0/main/postgresql.conf :   





so i tried to copy the old 9.0 tree to a machine with a still working 9,0   

postgres, but it stops with 

Starting PostgreSQL 9.0 database server: mainError: could not exec  

/usr/lib/postgresql/9.0/bin/pg_ctl /usr/lib/postgresql/9.0/bin/pg_ctl   

start -D /var/lib/postgresql/9.0/main -l

/var/log/postgresql/postgresql-9.0-main.log -s -o -c

config_file=/etc/postgresql/9.0/main/postgresql.conf : ... failed!

 failed! 
 so what can i do to extract the data of that tree and feed it into the 

 9.1 tree?  



 thanks in avance!  

--  

ciao bboett 

==  

bbo...@adlp.org 

http://inforezo.u-strasbg.fr/~bboett/   

=== 

   

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general