Thread: age

age

From
mixo
Date:
I lock rows based on 2 columns, "status" and "locktime". The idea is: if
the locktime has older than some age ( e.g. 1 minute), then the "status" bit
can be ignore, i.e. the lock expires. The problem I have is: if the
"locktime"
is "NULL" (this set when the lock is removed), then I can't get the age.
Is there a way to find the age of a column whose value can be or is  "NULL"?


Re: age

From
"Sam Liddicott"
Date:

> -----Original Message-----
> From: mixo [mailto:mixo@beth.uniforum.org.za]
> Sent: 16 July 2002 11:12
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] age
>
>
>
> I lock rows based on 2 columns, "status" and "locktime". The
> idea is: if
> the locktime has older than some age ( e.g. 1 minute), then
> the "status" bit
> can be ignore, i.e. the lock expires. The problem I have is: if the
> "locktime"
> is "NULL" (this set when the lock is removed), then I can't
> get the age.
> Is there a way to find the age of a column whose value can be
> or is  "NULL"?

Yeah, have another column for storing the age, or have another column to
store whether or not it is locked and don't use NULL in locktime.

You can't retreive data that you aren't storing.

Sam




Re: age

From
mixo
Date:
That would solve the problem completely if I did not have a situation
where "status" (the other column) was not NULL - the reason for it
being that way is that it was added when the table was modified and
a  default value was not set. But, for now I am going to check if the
"locktime" is NULL before proceeding.

Sam Liddicott wrote:

>Yeah, have another column for storing the age, or have another column to
>store whether or not it is locked and don't use NULL in locktime.
>
>You can't retreive data that you aren't storing.
>
>Sam
>
>
>
>