dbTalk Databases Forums  

Can funcation be activated on a certian date?

comp.databases.postgresql comp.databases.postgresql


Discuss Can funcation be activated on a certian date? in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fuzzydave
 
Posts: n/a

Default Can funcation be activated on a certian date? - 02-19-2007 , 03:08 AM






I am *still* working with a legacy system written in Python and
Postgres, the
current feature I am working on is to automatically modify project
status based
on a date. So for example a project named "THE EVIL PROJECT" has
begun
in development and is due for release on 28-12-2007 (british date
format) which
is stored in the database against the project ID. Using Python the
project status
would only be updated when the page that handles the project ID's is
accessed
But would it be possible to create a function that checks the current
date against
the database live date for each project and when they match run an
update
statement to automatically change the status ID for that project?

I know for functionallity like this a full programming language would
be better used
but the project is already so big that full re-write is not on the
cards and I was
hoping to find a way to make postgres do the work.

Cheers

David Phillips


Reply With Quote
  #2  
Old   
jpd
 
Posts: n/a

Default Re: Can funcation be activated on a certian date? - 02-19-2007 , 03:30 AM






Begin <1171876131.705694.290590 (AT) k78g2000cwa (DOT) googlegroups.com>
On 2007-02-19, Fuzzydave <dav.phillips (AT) ntlworld (DOT) com> wrote:
Quote:
[...] So for example a project named "THE EVIL PROJECT" has
begun
in development and is due for release on 28-12-2007 (british date
format) [...]
It might be wiser to opt for the ISO8601 standard date format. Simply
put, use YYYY-MM-DD. Or, if you have to use any other format, make sure
the month stands out; using the month name, abbreviation, or even roman
numerals like the French.


Quote:
But would it be possible to create a function that checks the current
date against
the database live date for each project and when they match run an
update
statement to automatically change the status ID for that project?
I'm not aware of any such functionality in PostgreSQL itself. The
simplest way on unix appears to be to use the system facility for that,
cron, or possibly at. You'd have cron run a script at set times that
does what you want.


Quote:
I know for functionallity like this a full programming language would
be better used
but the project is already so big that full re-write is not on the
cards and I was
hoping to find a way to make postgres do the work.
That depends on the structure of your application. Using cron to trigger
an external script means you're not bound by architecture issues but it
does mean you are introducing something that does things ``behind the
back'' of that application. Whether that is acceptable is up to you.
The cron triggered script can be anything from SQL queries, queries
triggering stored procedures, a complete program, to combinations of the
above. It's up to you.


--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.


Reply With Quote
  #3  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Can funcation be activated on a certian date? - 02-19-2007 , 07:03 AM



Fuzzydave <dav.phillips (AT) ntlworld (DOT) com> wrote:
Quote:
I am *still* working with a legacy system written in Python and
Postgres, the
current feature I am working on is to automatically modify project
status based
on a date. So for example a project named "THE EVIL PROJECT" has
begun
Is 'project' a database table?

Quote:
in development and is due for release on 28-12-2007 (british date
format) which
is stored in the database against the project ID. Using Python the
project status
would only be updated when the page that handles the project ID's is
accessed
But would it be possible to create a function that checks the current
date against
Are you looking for a function IN the database that operates on
database objects?

Quote:
the database live date for each project and when they match run an
update
statement to automatically change the status ID for that project?
If the answer to both of the above questions is 'yes', you can write
such a function using any PostgreSQL procedural language, I guess.

Quote:
I know for functionallity like this a full programming language would
be better used
but the project is already so big that full re-write is not on the
cards and I was
hoping to find a way to make postgres do the work.
PostgreSQL procedural languages are full programming languages.

Did I understand your problem correctly?
If not, maybe you can be more precise in the description of your setup
and your problem.

Yours,
Laurenz Albe


Reply With Quote
  #4  
Old   
EMartinez
 
Posts: n/a

Default Re: Can funcation be activated on a certian date? - 03-03-2007 , 11:41 PM



On Feb 19, 7:03 am, Laurenz Albe <inv... (AT) spam (DOT) to.invalid> wrote:
Quote:
Fuzzydave <dav.phill... (AT) ntlworld (DOT) com> wrote:
I am *still* working with a legacy system written in Python and
Postgres, the
current feature I am working on is to automatically modify project
status based
on a date. So for example a project named "THE EVIL PROJECT" has
begun

Is 'project' a database table?

in development and is due for release on 28-12-2007 (british date
format) which
is stored in the database against the project ID. Using Python the
project status
would only be updated when the page that handles the project ID's is
accessed
But would it be possible to create a function that checks the current
date against

Are you looking for a function IN the database that operates on
database objects?

the database live date for each project and when they match run an
update
statement to automatically change the status ID for that project?

If the answer to both of the above questions is 'yes', you can write
such a function using any PostgreSQL procedural language, I guess.

I know for functionallity like this a full programming language would
be better used
but the project is already so big that full re-write is not on the
cards and I was
hoping to find a way to make postgres do the work.

PostgreSQL procedural languages are full programming languages.

Did I understand your problem correctly?
If not, maybe you can be more precise in the description of your setup
and your problem.

Yours,
Laurenz Albe
If you are using a Windows O/S, you should be able to use Psql to call
a database function, via a batch file, in a scheduled task that can
run periodically, similar to the previous reference to cron jobs.

Regards,

Enrique Martinez
Sr Web/Database Developer



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.