Thread: Execute Immediate
In many SQL dialets there is the availability of Execute immediate which allows you to build global temp tables or views at run time and even stored procedures at runtime and then execute them inline. Is there a way to do this in PostGres 8.4
Best Regards
Michael Gould, Managing Partner
Intermodal Software Solutions, LLC
Intermodal Software Solutions, LLC
904.226.0978
904.592.5250 fax
Hello plpgsql has execute statement, that has similar behave like execute immediate in others systems. note - postgresql doesn't support global temp tables yet. regards Pavel Stehule 2009/7/12 Michael Gould <mgould@intermodalsoftwaresolutions.net>: > In many SQL dialets there is the availability of Execute immediate which > allows you to build global temp tables or views at run time and even stored > procedures at runtime and then execute them inline. Is there a way to do > this in PostGres 8.4 > > > > Best Regards > > > > ________________________________ > Michael Gould, Managing Partner > Intermodal Software Solutions, LLC > 904.226.0978 > 904.592.5250 fax
Thanks, that is exactly what I need as a workaround to session variables. The temp tables will work as we need them as we only have a 5 that are temp tables and preserve is needed only for the active session, once the session has ended the temp table should go away. "Pavel Stehule" wrote: > 2009/7/12 Michael Gould <mgould@intermodalsoftwaresolutions.net>: >> It does look to me that PostGres supports temporary tables and using with >> the commit preserve rows appears to work similar to how global or local temp >> tables would work. The only thing I need to know (or test) is whether they >> are session or connection safe. > > temp tables in pg are related to session. After session end, the temp > tables are automatically dropped. > > postgresql has not session variables - but you can emulate it > > http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Any_other_session_variables > http://www.postgresql.org/docs/8.3/static/plperl-global.html > > regards > Pavel Stehule > >> >> Besides global or local temp tables, I would like to see a CREATE Variable >> which would allow a global variable to be created and used. It would allow >> the ability to set and retrieve values once instead of doing the select each >> time. These variables have a session life and must be set each time you >> login to the system. >> >> Best Regards >> >> Michael Gould >> >> >> >> >> "Pavel Stehule" wrote: >>> Hello >>> >>> plpgsql has execute statement, that has similar behave like execute >>> immediate in others systems. >>> >>> note - postgresql doesn't support global temp tables yet. >>> >>> regards >>> Pavel Stehule >>> >>> 2009/7/12 Michael Gould <mgould@intermodalsoftwaresolutions.net>: >>>> In many SQL dialets there is the availability of Execute immediate which >>>> allows you to build global temp tables or views at run time and even >> stored >>>> procedures at runtime and then execute them inline. Is there a way to do >>>> this in PostGres 8.4 >>>> >>>> >>>> >>>> Best Regards >>>> >>>> >>>> >>>> ________________________________ >>>> Michael Gould, Managing Partner >>>> Intermodal Software Solutions, LLC >>>> 904.226.0978 >>>> 904.592.5250 fax >>> >>> -- >>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org) >>> To make changes to your subscription: >>> http://www.postgresql.org/mailpref/pgsql-general >>> >> >> -- >> Michael Gould, Managing Partner >> Intermodal Software Solutions, LLC >> 904.226.0978 >> 904.592.5250 fax >> >> >> > -- Michael Gould, Managing Partner Intermodal Software Solutions, LLC 904.226.0978 904.592.5250 fax