Curious situation - running program cannot seem to delete records.

From: Andrew Edson <cheighlund(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Curious situation - running program cannot seem to delete records.
Date: 2007-02-28 14:51:21
Message-ID: 485363.56168.qm@web34202.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've been given a file to maintain, the purpose of which is to purge the database of records more than two years old. (Database setup is pg 8.1.3)

The program (written in perl) enters postgres as the user 'postgres', and is supposed to select foreign-key records from all tables that link together with a table which has a delete_dt field in it, so long as the delete_dt value (timestamp with time zone) is more than two years old. It then, within a running loop, is supposed to table-by-table delete all records where the value of the key in question matches the returned value. Delete command is simply 'DELETE FROM [table] WHERE [key] = [result variable]'. Result variables are set as [Variable] = $result[x] where $result is the return from the select and x is the relative location of the value in question within the select.

The program can apparently enter the database quite nicely, because it's capable of running the initial select statement and receiving results; a set of print statements to the log file that the program creates reveals that it's getting the information. However, it seems to be unable to delete records; going into the database after the program finishes running and running the select statement from within the program yields exactly the same records as doing so before the delete program runs.

Does anyone know of anything in Postgres that might be causing this unusual behavior? Or should I check the perl mailing lists instead?

Thank you for your consideration.


---------------------------------
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arnaud Lesauvage 2007-02-28 14:57:54 Re: Curious situation - running program cannot seem to delete records.
Previous Message Shelby Cain 2007-02-28 14:45:11 Re: How to Kill IDLE users