Re: Explicit psqlrc

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: gabrielle <gorthx(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Mark Wong <markwkm(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Explicit psqlrc
Date: 2010-07-20 15:48:29
Message-ID: AANLkTim68f_Q_f2geksy5TXOP=UnrJ6rcx7DschfKp75@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 20, 2010 at 11:23 AM, David Christensen <david(at)endpoint(dot)com> wrote:
>> Well, IIRC, one of -c and -f suppresses psqlrc, and the other does
>> not.  This doesn't seem very consistent to me, but I'm not sure
>> there's much to be done about it at this point.  I guess if you use
>> whichever one suppresses psqlrc even once, it's suppressed, and
>> otherwise it's not.  :-(
>
> That seems sub-optimal; I can see people wanting to use this feature to do something like:
>
> psql -c 'set work_mem = blah' -f script.sql
>
> and then being surprised when it works differently than just `psql -f script.sql`.

I agree... but then they might also be surprised if psql -c
'something' works differently from psql -c 'something' -f /dev/null

> Although I wonder if the general usecase for .psqlrc is just in interactive mode; i.e., hypothetically if you're running scripts that are sensitive to environment, you're running with -X anyway; so maybe that's not that big of a deal, as it's kind of an implied -X with multiple -c or -f commands.  And if you really wanted it, we could add a flag to explicitly include .psqlrc (or the user could just specify -f path/to/psqlrc).

It's tempting to propose making .psqlrc apply only in interactive
mode, period. But that would be an incompatibility with previous
releases, and I'm not sure it's the behavior we want, either.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-07-20 15:51:34 Re: Query optimization problem
Previous Message Artur Dabrowski 2010-07-20 15:46:20 Re: Incorrect FTS result with GIN index