Re: [HACKERS] Is there any utility to update the table whenever text file gets changed?

From: "Jim C(dot) Nasby" <jimn(at)enterprisedb(dot)com>
To: Dhanaraj M <Dhanaraj(dot)M(at)Sun(dot)COM>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Is there any utility to update the table whenever text file gets changed?
Date: 2006-09-16 21:02:35
Message-ID: 20060916210234.GD38854@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thu, Sep 14, 2006 at 03:41:06AM -0700, Dhanaraj M wrote:
> Is there any utility in postgresql which can do the following?

Moving to pgsql-general, which is the appropriate list for this.

> The utility must update the table whenever there is any change in the
> text file.
> COPY command helps to do that, though this is not straight forward.
> Can it be automated?

There's nothing in the database that could do this directly. You'd need
some kind of code at the OS level that would watch the file for changes
and then take appropriate action. Any number of languages would be
capable of this. Also note that you should probably do the copy into
something other than the live table in case something goes wrong. You
can then do:

BEGIN;
DROP TABLE real_table;
ALTER TABLE fake_table RENAME real_table;
COMMIT;
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2006-09-17 00:51:52 Re: [HACKERS] Is there any utility to update the table whenever text
Previous Message Tom Lane 2006-09-16 16:42:02 Re: Fwd: Multiple entries of same table in pg_class

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-09-16 21:04:06 Re: minor feature request: Secure defaults during function creation
Previous Message Joshua D. Drake 2006-09-16 20:27:09 Re: [HACKERS] Developer's Wiki