Re: Using a Makefile during database development

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using a Makefile during database development
Date: 2004-01-18 20:34:20
Message-ID: 400AEDCC.4050702@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Bill Moran <wmoran(at)potentialtech(dot)com> writes:
>
>>The problem I'm hitting is this: how can I teach make to know when a
>>particular file is newer than the data in the database?
>
>
> AFAIK there's no direct way to do that; all of make's decisions are
> based on existence and mod times of files, so you can't persuade it to
> test directly for SQL-level conditions.
>
> However, this sort of problem comes up in many contexts, and make users
> have developed a standard solution: you create or touch an empty
> "timestamp" file when you do an action such as updating the database
> from a particular collection of source files. The mod time of the
> timestamp file can then serve as the comparison value telling make
> whether to do it again. A typical rule would look like:
>
> db_update.stamp: somefile.sql someotherfile.sql
> psql mydb -f somefile.sql
> psql mydb -f someotherfile.sql
> touch db_update.stamp
>
> You make one stamp file for each action you might or might not need to
> do, and then user-level targets look like
>
> update: db_update.stamp ...

Thanks, Tom.

I had considered this approach, but it seemed rather clunky. The way you
describe it doesn't make it sound so bad, though.

I was hoping there was some way to track this using a backticked command
or something.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2004-01-18 20:44:35 Re: Great change (size of data dir) upgrading postgresql
Previous Message Joshua D. Drake 2004-01-18 20:29:32 Re: computed field on a table