pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Variables.
2+ messages / 2 participants
[nested] [flat]

* Variables.
@ 2001-10-17 01:00  Aasmund Midttun Godal <postgresql@envisity.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Aasmund Midttun Godal @ 2001-10-17 01:00 UTC (permalink / raw)
  To: pgsql-sql

I would really like a feature :)

I do not know whether it is  part of the SQL standard.

Variables...

e.g.

CREATE VARIABLE foobar INTEGER DEFAULT 1 NOT NULL;

SELECT * FROM thebar WHERE id = foobar;

CREATE TEMPORARY VARIABLE...
CREATE CONSTANT....

Basically all the functionality from the table columns (CHECK and REFERENCES...) and it must take any type, so that you can use user-created types as well.

SET foobar 3;

it could adopt properties from both runtime info and sequences...

My abilities in C, as in many other things is severely limited so I am asking someone else to do the dirtywork :). And I do appreciate that this may take some time.

It would be nice to have some sort of GRANT revoke SCHEME on it too...

I do acknowledge that this can be achieved with temporary and non temporary tables, but it can get ugly with these.

While I am at it I would highly suggest that there is some sort of SESSION_ID environment variable.

Some of the uses:

* Store things like personal  preferences
* Parameters from a webserver
* Client application name
* etc.






Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Variables.
@ 2001-10-17 15:44  Josh Berkus <josh@agliodbs.com>
  parent: Aasmund Midttun Godal <postgresql@envisity.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Josh Berkus @ 2001-10-17 15:44 UTC (permalink / raw)
  To: Aasmund Midttun Godal <postgresql@envisity.com>; pgsql-sql

Aasmund,

> I do not know whether it is  part of the SQL standard.
> 
> Variables...

Nope.
 
> CREATE VARIABLE foobar INTEGER DEFAULT 1 NOT NULL;
> 
> SELECT * FROM thebar WHERE id = foobar;
> 
> CREATE TEMPORARY VARIABLE...
> CREATE CONSTANT....

Extensive support for a variety of variable types and constructions is
available in FUNCTIONS.  PL/pgSQL, PL/TCL, PL/Perl ... take your pick.

For the raw command-line SQL, variables, constants, and other procedural
language elements are not appropriate.  This is best done in procedures,
functions, and middleware.

Of course, it is an Open-Source project, so if you hire your own
programmer, you can do anything you want.

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco







^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-10-17 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-17 01:00 Variables. Aasmund Midttun Godal <postgresql@envisity.com>
2001-10-17 15:44 ` Josh Berkus <josh@agliodbs.com>

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