pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Medi Montaseri <montaseri@gmail.com>
To: giuseppe.derossi@email.it
Cc: pgsql-admin@postgresql.org
Subject: Re: how to call sql code without function
Date: Mon, 20 Aug 2007 10:29:03 -0700
Message-ID: <8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com> (raw)
In-Reply-To: <982e37715bf2f368a09ab98ac244a032@83.225.20.212>
References: <982e37715bf2f368a09ab98ac244a032@83.225.20.212>

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.

The other solution which I prefer is to write a stored procedure to solve
this. Or get creative with nested and complex SQL queries.

Cheers
Medi


On 8/20/07, giuseppe.derossi@email.it <giuseppe.derossi@email.it> wrote:
>
>
> Hi all,
> I use Postgresql 8.2 in win env. I wrote a set of complex queries which
> return three temporary tables of results. I want to use then in php, but
> the
> unique way I know consists on sending one query a time via php, the logic
> I
> need has now been cablated into the sql code.
> I could use the functions but it seems a bit long becouse I set some
> temporary tables and I shoud use dynamic queries and I've more then a
> recordset.
> Is there a way to store this piece of sql code into the database and to
> recall it with the right input by php and to read only the two tables of
> results via PHP?
>
> thanks in advantage
>
> giu
>
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> In REGALO un GIOCO! Scegli GPBikes 3D,Bubble Boom, Rock City Empire
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6732&d=20070820
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>

view thread (7+ messages)  latest in thread

Message-ID: <8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com>
Permalink:  ../8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com/
Also on:    postgresql.org/message-id/8078a1730708201029o744efd76yb96c5e4c2cac54fe@mail.gmail.com

 · 

reply

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: montaseri@gmail.com, giuseppe.derossi@email.it
  Subject: Re: how to call sql code without function
  In-Reply-To: <8078a1730708201029o744efd76yb96c5e4c2cac54fe@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