plpgsql and prep statements (performance and sql injection)

From: Wim Bertels <wim(dot)bertels(at)khleuven(dot)be>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql and prep statements (performance and sql injection)
Date: 2011-07-06 09:11:37
Message-ID: 1309943497.2333.43.camel@zwerfkat
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hallo,

good reasons to use prep statements
seem
- performance
- some sql injection defence

but when i look at plpgsql
http://www.postgresql.org/docs/8.4/interactive/plpgsql-implementation.html
i see that sql statements are translated into prep statements,
and live (the plan) as long the db connection is open

so there seems nothing to be gained from using
prep statements inside a plpgsql function,
the only reason could be the lifecycle of the prep statements
(which u don't really control for the translated sql functions inside
plpgsql functions). So i would be nice to have an extra feature in
plpgsql functions like imm,sta,vol (planning) but then to control the
duration/lifetime of the translated statements inside the plpgsql
function.

also,
since the keyword 'EXECUTE' is ambivalent i don't see at this point how
u can execute a prep statement inside a plpgsql function.

Comments?

mvg,
Wim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2011-07-06 09:29:47 Re: plpgsql and prep statements (performance and sql injection)
Previous Message BangarRaju Vadapalli 2011-07-06 08:57:53 Performance Monitoring of PostGRE