cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: ignore psqlrc entirely in psql

Open sobrinho opened this issue 4 years ago • 7 comments

This will make users with \timing on in .psqlrc on PG 12+ happy because it does not ignore the psqlrc with -c anymore.

sobrinho avatar Apr 09 '20 16:04 sobrinho

The option -X is available since PG 7.1, PG 12 changed the -c to not ignore psqlrc by default.

sobrinho avatar Apr 09 '20 16:04 sobrinho

Ping.

sobrinho avatar May 11 '20 11:05 sobrinho

Ping.

sobrinho avatar May 27 '20 12:05 sobrinho

@sobrinho would you elaborate on what you are wanting to maintain or change here? I've had a few of us look and we're all a bit confused on your expectation (our fault!).

RasPhilCo avatar Jun 09 '20 19:06 RasPhilCo

@RasPhilCo until pg 11, using -c would make psql ignore the ~/.psqlrc.

But since pg 12, -c doesn't ignore it anymore, you need to explicitly use -X.

The good thing is that -X exists since pg 7.1 for this, we don't need to worry about backward incompatibility with ancient pgs.

sobrinho avatar Jun 09 '20 23:06 sobrinho

@RasPhilCo maybe I forgot to mention why we need this 🤦

This is to avoid this output when we use heroku pg:pull:

 ▸    WARNING: Extensions in newly created target database differ from existing source database.
 ▸    Target extensions:
 ▸    extname
 ▸    -----------
 ▸    pgcrypto
 ▸    plpgsql
 ▸    unaccent
 ▸    uuid-ossp
 ▸    (4 rows)
 ▸
 ▸    Time: 1.153 ms
 ▸
 ▸    Source extensions:
 ▸    extname
 ▸    -----------
 ▸    pgcrypto
 ▸    plpgsql
 ▸    unaccent
 ▸    uuid-ossp
 ▸    (4 rows)
 ▸
 ▸    Time: 138.152 ms
 ▸
 ▸    HINT: You should review output to ensure that any errors
 ▸    ignored are acceptable - entire tables may have been missed, where a dependency
 ▸    could not be resolved. You may need to to install a postgresql-contrib package
 ▸    and retry.

But that message only appears because I have \timing on in my .psqlrc and that's the only difference the query of the extensions in Heroku and my local database after pulling.

sobrinho avatar Jul 24 '20 22:07 sobrinho

@RasPhilCo do you understand what this PR is trying to accomplish yet (regain ability to ignore .psqrc file when sending commands)?

Do we know what is left to get compliance to sign off on the PR?

datachomp avatar Apr 26 '22 03:04 datachomp