Обсуждение: why no create variable

Поиск
Список
Период
Сортировка

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


Re: why no create variable

От
Jasen Betts
Дата:
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

Re: why no create variable

От
Дата:
create table works but causes a lot of selects through out the program to get various settings when using CREATE Variable and have it global means that you can set these values once when doing your init routine and not have to continuously go back to the table in every stored procedure to get the same data over and over.  In my case I almost 99% of the time set these values from table values and then use them in read only mode.  These are things that are normally static.  I also have a group of "flags" that get initialized to 0 and can get set to 1 to help determine actions to take in a stored procedure.

Getting the information from a table works.  I now have a sessionsettings table, but I'm making way to many calls to it because there is no global pool of variable.  Not IMO an efficient use of a table.

Michael Gould
Intermodal Software Solutions, LLC
904-226-0978


-------- Original Message --------
Subject: Re: [GENERAL] why no create variable
From: Jasen Betts <jasen@xnet.co.nz>
Date: Sat, March 17, 2012 9:57 pm
To: pgsql-general@postgresql.org

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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: why no create variable

От
Chris Angelico
Дата:
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