Thread: why no create variable
There seems to be CREATE everything in Postgres but it would be really nice to have a CREATE VARIABLE which would allow us to create global variables. I know there are other techniques but this would be the easiest when doing a init routine when a user logs in to the application. Best Regards Michael Gould Intermodal Software Solutions, LLC 904-226-0978
On 2012-03-08, <mgould@isstrucksoftware.net> <mgould@isstrucksoftware.net> wrote: > There seems to be CREATE everything in Postgres but it would be really > nice to have a CREATE VARIABLE which would allow us to create global > variables. I know there are other techniques but this would be the > easiest when doing a init routine when a user logs in to the > application. create a table. -- ⚂⚃ 100% natural
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" style="empty-cells: show;" width="100%"><tr><td;=";" </td="</td" align="left" background="cid:top@0806bc3b5582e9c00e3ec501d1d1b06b" colspan="1" height="72"style="text-align: left; background-repeat: no-repeat;"></td></tr><tr><td style="vertical-align: top;"><div style="padding:5px; overflow-x: auto;"></div></td></tr></table><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div>createtable works but causes a lot of selects through out the program to get various settings whenusing CREATE Variable and have it global means that you can set these values once when doing your init routine and nothave to continuously go back to the table in every stored procedure to get the same data over and over. In my case Ialmost 99% of the time set these values from table values and then use them in read only mode. These are things that arenormally static. I also have a group of "flags" that get initialized to 0 and can get set to 1 to help determine actionsto take in a stored procedure.</div><div><br /></div><div>Getting the information from a table works. I now havea sessionsettings table, but I'm making way to many calls to it because there is no global pool of variable. Not IMOan efficient use of a table.<br /></div><div><br /></div><div>Michael Gould</div><div>Intermodal Software Solutions, LLC</div><div>904-226-0978</div><div><br/><br /></div><blockquote id="replyBlockquote" style="border-left: 2px solid blue;margin-left: 8px; padding-left: 8px; font-size:10pt; color:black; font-family:verdana;" webmail="1"><div id="wmQuoteWrapper">-------- Original Message --------<br /> Subject: Re: [GENERAL] why no create variable<br /> From: JasenBetts <<a href="mailto:jasen@xnet.co.nz">jasen@xnet.co.nz</a>><br /> Date: Sat, March 17, 2012 9:57 pm<br /> To:<a href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org</a><br /><br /> On 2012-03-08, <<a href="mailto:mgould@isstrucksoftware.net">mgould@isstrucksoftware.net</a>><<a href="mailto:mgould@isstrucksoftware.net">mgould@isstrucksoftware.net</a>>wrote:<br /> > There seems to be CREATE everythingin Postgres but it would be really<br /> > nice to have a CREATE VARIABLE which would allow us to create global<br/> > variables. I know there are other techniques but this would be the<br /> > easiest when doing a initroutine when a user logs in to the<br /> > application.<br /><br /> create a table.<br /><br /> -- <br /> ⚂⚃ 100%natural<br /><br /><br /> -- <br /> Sent via pgsql-general mailing list (<a href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org</a>)<br/> To make changes to your subscription:<br/><a href="http://www.postgresql.org/mailpref/pgsql-general">http://www.postgresql.org/mailpref/pgsql-general</a><br /></div></blockquote></span>
On Sun, Mar 18, 2012 at 11:26 PM, <mgould@isstrucksoftware.net> wrote: > > Getting the information from a table works. I now have a sessionsettings table, but I'm making way to many calls to itbecause there is no global pool of variable. Not IMO an efficient use of a table. Chances are that table, if you are indeed using it a lot, will be cached. It'll end up fairly cheap. But just out of vague curiosity, I wonder how viable it would be to create functions for all your global variables - each one is thus a function returning its value. ChrisA