Обсуждение: [HACKERS] Useful addition for psql?
With things like the date format now being set via the SET command rather than as a compile-time option, I think it would be nice for psql to read ~/.psqlrc (or some such thing) as a set of commands (or SQL) to read whenever it is run. Thus you could put SET datestyle TO 'european,sql' into this file to default to those setting whenever you run psql. Any thoughts before I start hacking? Andrew - ---------------------------------------------------------------------------- Dr. Andrew C.R. Martin University College London EMAIL: (Work) martin@biochem.ucl.ac.uk (Home) andrew@stagleys.demon.co.uk URL: http://www.biochem.ucl.ac.uk/~martin Tel: (Work) +44(0)171 419 3890 (Home) +44(0)1372 275775 ------------------------------
> for psql to read ~/.psqlrc (or some such thing) as a set of
psql already takes some environment variables and sends them
to the server. In fact, libpq does that. I think it is called
PG_DATE or such? (Hmm, maybe I should have documented it somewhere :)
mjl
------------------------------
On Fri, 20 Jun 1997, Andrew Martin wrote:
>
> With things like the date format now being set via the SET command
> rather than as a compile-time option, I think it would be nice
> for psql to read ~/.psqlrc (or some such thing) as a set of
> commands (or SQL) to read whenever it is run. Thus you could
> put
> SET datestyle TO 'european,sql'
> into this file to default to those setting whenever you run
> psql.
>
> Any thoughts before I start hacking?
sounds like a reasonable extension to have, for those that want it...
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org scrappy@freebsd.org
------------------------------
On Fri, 20 Jun 1997, Martin J. Laubach wrote:
> > for psql to read ~/.psqlrc (or some such thing) as a set of
>
> psql already takes some environment variables and sends them
> to the server. In fact, libpq does that. I think it is called
> PG_DATE or such? (Hmm, maybe I should have documented it somewhere :)
IMHO, a .psqlrc file would be easier overall...should even have
some sort of 'global' one, maybe? Or maybe use env variables for global
settings, to be overwritten by a psqlrc?
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org scrappy@freebsd.org
------------------------------
Ingres has this, and I think it is a good idea. > > On Fri, 20 Jun 1997, Andrew Martin wrote: > > > > > With things like the date format now being set via the SET command > > rather than as a compile-time option, I think it would be nice > > for psql to read ~/.psqlrc (or some such thing) as a set of > > commands (or SQL) to read whenever it is run. Thus you could > > put > > SET datestyle TO 'european,sql' > > into this file to default to those setting whenever you run > > psql. > > > > Any thoughts before I start hacking? > > sounds like a reasonable extension to have, for those that want it... > > Marc G. Fournier scrappy@hub.org > Systems Administrator @ hub.org scrappy@freebsd.org > > > - -- Bruce Momjian maillist@candle.pha.pa.us ------------------------------
On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
> Marc G. Fournier wrote:
> >
> > On Fri, 20 Jun 1997, Martin J. Laubach wrote:
> >
> > > > for psql to read ~/.psqlrc (or some such thing) as a set of
> > >
> > > psql already takes some environment variables and sends them
> > > to the server. In fact, libpq does that. I think it is called
> > > PG_DATE or such? (Hmm, maybe I should have documented it somewhere :)
> >
> > IMHO, a .psqlrc file would be easier overall...should even have
> > some sort of 'global' one, maybe? Or maybe use env variables for global
> > settings, to be overwritten by a psqlrc?
>
> IMHO, 'global' one is fine idea. It may be used by different
> applications and proccessed by libpq on startup automatically.
> After 'global' is proccessed additional commands from .psqlrc
> may be posted to backend as well...
>
> What about user profiles stored in database in system pg_profile
> table ? We live in virtual world...
I'd think that would be the optimal way to do it, myself...if I
backup the database server to a tape, I'm not going to add in each individual
users .psqlrc files, but if that information is stored in a pg_profile file,
then it automagically gets backed up...
My vote is in favor of a pg_profile table *instead of* flat files
in the users directory. When createdb is run, have a 'system default'
profile written to that databases pg_profile? Or would each table created
have a 'profile'?
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org scrappy@freebsd.org
------------------------------
Marc G. Fournier wrote: > > On Fri, 20 Jun 1997, Martin J. Laubach wrote: > > > > for psql to read ~/.psqlrc (or some such thing) as a set of > > > > psql already takes some environment variables and sends them > > to the server. In fact, libpq does that. I think it is called > > PG_DATE or such? (Hmm, maybe I should have documented it somewhere :) > > IMHO, a .psqlrc file would be easier overall...should even have > some sort of 'global' one, maybe? Or maybe use env variables for global > settings, to be overwritten by a psqlrc? IMHO, 'global' one is fine idea. It may be used by different applications and proccessed by libpq on startup automatically. After 'global' is proccessed additional commands from .psqlrc may be posted to backend as well... What about user profiles stored in database in system pg_profile table ? We live in virtual world... Vadim ------------------------------
On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
> > in the users directory. When createdb is run, have a 'system default'
> > profile written to that databases pg_profile? Or would each table created
> ^^^^
> Why not in .../data dirrectory ? User may connect to different databases...
Would a user necessariloy want the same settings for all databases they
access? for all tables?
> ...But - it requires dump/reload...
> .pgsqlrc doesn't...
True...add .pgsqlrc, if possible, in time for Bruce's desire for
a quick *one time only* v6.1 mega patch, and then throw in the pg_profile
table right after?
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org scrappy@freebsd.org
------------------------------
Marc G. Fournier wrote:
>
> On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
>
> > Marc G. Fournier wrote:
> > >
> > > IMHO, a .psqlrc file would be easier overall...should even have
> > > some sort of 'global' one, maybe? Or maybe use env variables for global
> > > settings, to be overwritten by a psqlrc?
> >
> > IMHO, 'global' one is fine idea. It may be used by different
> > applications and proccessed by libpq on startup automatically.
> > After 'global' is proccessed additional commands from .psqlrc
> > may be posted to backend as well...
> >
> > What about user profiles stored in database in system pg_profile
> > table ? We live in virtual world...
>
...
>
> My vote is in favor of a pg_profile table *instead of* flat files
^^^^^^^^^^^^
We may add both features and let ppl to decide what to use.
pg_profile will be processed by backend before any commands from client
and so .pgsqlrc (or like one) may overwrite default settings for user.
> in the users directory. When createdb is run, have a 'system default'
> profile written to that databases pg_profile? Or would each table created
^^^^
Why not in .../data dirrectory ? User may connect to different databases...
...But - it requires dump/reload...
.pgsqlrc doesn't...
Vadim
------------------------------
> What about user profiles stored in database in system pg_profile
> table ? We live in virtual world...
Yes, but I may need different .psqlrc for different databases.
I'd say
- global rc file (maybe in a pg_profile table)
- user settings (~/.pgrc, or maybe in the database too?)
- extra user settings (./.pgrc, or specified on command line)
mjl
------------------------------
Marc G. Fournier wrote:
>
> On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
>
> > > in the users directory. When createdb is run, have a 'system default'
> > > profile written to that databases pg_profile? Or would each table created
> > ^^^^
> > Why not in .../data dirrectory ? User may connect to different databases...
>
> Would a user necessariloy want the same settings for all databases they
> access?
pg_profile in /data:
usesysid int4
database oid
^^^^^^^^^^^^^^^^^^^ - if this oid is invalid that these
settings are global (to be processed
first)
settings text
> for all tables?
^^^^^^^^^^^^^^
Currently, all our settings affect session at whole...
I haven't idea about usefull table-level settings.
>
> > ...But - it requires dump/reload...
> > .pgsqlrc doesn't...
>
> True...add .pgsqlrc, if possible, in time for Bruce's desire for
> a quick *one time only* v6.1 mega patch, and then throw in the pg_profile
> table right after?
Yes.
Vadim
------------------------------
On Fri, 20 Jun 1997, Martin J. Laubach wrote:
> > What about user profiles stored in database in system pg_profile
> > table ? We live in virtual world...
>
> Yes, but I may need different .psqlrc for different databases.
> I'd say
>
> - global rc file (maybe in a pg_profile table)
> - user settings (~/.pgrc, or maybe in the database too?)
> - extra user settings (./.pgrc, or specified on command line)
Take a look at the gated.conf/named.conf files...they have it
setup so that you have {}'d configuration sections...
Why not something that goes:
settings database1 {
options here
}
settings database2 {
option here
}
etc
One config file, many directives...
hell, while we are at it, why not go one step further and add an
option from that file to do the security on a per-database basis...oops,
nope, that would have to be in the pg_profile, where the owner could setup
'access privileges' like is in pg_hba.conf without having to bother the
superuser?
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org scrappy@freebsd.org
------------------------------
Shouldn't all this go into 6.2? In my opinion, only critical patches
should be applied to the release.
=+=------------------------/\---------------------------------=+=
Igor Natanzon |**| E-mail: igor@sba.miami.edu
=+=------------------------\/---------------------------------=+=
On Fri, 20 Jun 1997, Marc G. Fournier wrote:
> On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
>
> > > in the users directory. When createdb is run, have a 'system default'
> > > profile written to that databases pg_profile? Or would each table created
> > ^^^^
> > Why not in .../data dirrectory ? User may connect to different databases...
>
> Would a user necessariloy want the same settings for all databases they
> access? for all tables?
>
> > ...But - it requires dump/reload...
> > .pgsqlrc doesn't...
>
> True...add .pgsqlrc, if possible, in time for Bruce's desire for
> a quick *one time only* v6.1 mega patch, and then throw in the pg_profile
> table right after?
>
> Marc G. Fournier scrappy@hub.org
> Systems Administrator @ hub.org scrappy@freebsd.org
>
>
------------------------------
On Fri, 20 Jun 1997, Igor wrote:
> Shouldn't all this go into 6.2? In my opinion, only critical patches
> should be applied to the release.
i'm not too nervous about frontend related 'features' being added...
its the backend stuff that is, IMHO, more crucial...
that said, pretty much anything that is deemed to be 'safe' and
that *doesn't* require a dump/reload is eligable for inclusion into the
v6.1p1 release...
Purify patches, IMHO, are *perfect* candidates at pretty much any
time :)
>
> =+=------------------------/\---------------------------------=+=
> Igor Natanzon |**| E-mail: igor@sba.miami.edu
> =+=------------------------\/---------------------------------=+=
>
> On Fri, 20 Jun 1997, Marc G. Fournier wrote:
>
> > On Fri, 20 Jun 1997, Vadim B. Mikheev wrote:
> >
> > > > in the users directory. When createdb is run, have a 'system default'
> > > > profile written to that databases pg_profile? Or would each table created
> > > ^^^^
> > > Why not in .../data dirrectory ? User may connect to different databases...
> >
> > Would a user necessariloy want the same settings for all databases they
> > access? for all tables?
> >
> > > ...But - it requires dump/reload...
> > > .pgsqlrc doesn't...
> >
> > True...add .pgsqlrc, if possible, in time for Bruce's desire for
> > a quick *one time only* v6.1 mega patch, and then throw in the pg_profile
> > table right after?
> >
> > Marc G. Fournier scrappy@hub.org
> > Systems Administrator @ hub.org scrappy@freebsd.org
> >
> >
>
Marc G. Fournier
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
------------------------------