From: Scott Marlowe <scott.marlowe@gmail.com>
To: Medi Montaseri <montaseri@gmail.com>
Cc: giuseppe.derossi@email.it
Cc: pgsql-admin@postgresql.org
Subject: Re: how to call sql code without function
Date: Mon, 20 Aug 2007 13:03:10 -0500
Message-ID: <dcc563d10708201103t743f17a2s9678b916a387c378@mail.gmail.com> (raw)
In-Reply-To: <8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com>
References: <982e37715bf2f368a09ab98ac244a032@83.225.20.212>
<8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com>
On 8/20/07, Medi Montaseri <montaseri@gmail.com> wrote:
> You can think of a database as a filesystem as well. That is do some
> processing, store the result in temp table, do some more, etc,etc then merge
> and process temp tables to arrive at some result.
>
> Just as in the case of filesystem, if you are operating in a concurrent
> evironment, you need to fence against that. That is it is possible that at a
> given time two sessions will arrive at the same processing point where they
> need to create such temp tables.
Each session will get it's own temp table, even if they have the same name.
The real issue is what they do with the data in that temp table to
make sure that they're committing changes that make sense given the
current state of data in the database.
> The other solution which I prefer is to write a stored procedure to solve
> this. Or get creative with nested and complex SQL queries.
Note that nested queries still have some race conditions (such as with
aggregate functions) in postgresql.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott.marlowe@gmail.com, montaseri@gmail.com, giuseppe.derossi@email.it
Subject: Re: how to call sql code without function
In-Reply-To: <dcc563d10708201103t743f17a2s9678b916a387c378@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox