Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable PGUSER env when checking for existing database #380

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

robins
Copy link
Contributor

@robins robins commented Jan 17, 2022

Alike for when pgx does CREATE DATABASE, this commit forces disabling of PGUSER when checking for existing database.

This failed on my test setup, since I had setup PGUSER (for other projects) but that caused cargo pgx init to fail.

There is no need to disable PGHOST / PGPASSWORD / PGPORT since that's being set at this point anyway (so they would override the env settings)

@Hoverbear
Copy link
Contributor

Could you help me understand how to replicate the failure? I tried setting my PGUSER to something nonsense and it still worked just fine. I also tried starting postgres to see if that helped.

ana@autonoma:~/git/zombodb/pgx$ export PGUSER=booper
ana@autonoma:~/git/zombodb/pgx$ cargo pgx init
  Discovered Postgres v14.1, v13.5, v12.9, v11.14, v10.19
  Downloading Postgres v12.9 from https://ftp.postgresql.org/pub/source/v12.9/postgresql-12.9.tar.bz2
  Downloading Postgres v13.5 from https://ftp.postgresql.org/pub/source/v13.5/postgresql-13.5.tar.bz2
  Downloading Postgres v14.1 from https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.bz2
  Downloading Postgres v11.14 from https://ftp.postgresql.org/pub/source/v11.14/postgresql-11.14.tar.bz2
  Downloading Postgres v10.19 from https://ftp.postgresql.org/pub/source/v10.19/postgresql-10.19.tar.bz2
     Removing /home/ana/.pgx/12.9
     Removing /home/ana/.pgx/10.19
    Untarring Postgres v12.9 to /home/ana/.pgx/12.9
    Untarring Postgres v10.19 to /home/ana/.pgx/10.19
     Removing /home/ana/.pgx/13.5
    Untarring Postgres v13.5 to /home/ana/.pgx/13.5
     Removing /home/ana/.pgx/14.1
    Untarring Postgres v14.1 to /home/ana/.pgx/14.1
  Configuring Postgres v10.19
  Configuring Postgres v12.9
  Configuring Postgres v13.5
  Configuring Postgres v14.1
     Removing /home/ana/.pgx/11.14
    Untarring Postgres v11.14 to /home/ana/.pgx/11.14
    Compiling Postgres v10.19
    Compiling Postgres v12.9
    Compiling Postgres v13.5
  Configuring Postgres v11.14
    Compiling Postgres v14.1
    Compiling Postgres v11.14
   Installing Postgres v10.19 to /home/ana/.pgx/10.19/pgx-install
   Installing Postgres v12.9 to /home/ana/.pgx/12.9/pgx-install
   Installing Postgres v13.5 to /home/ana/.pgx/13.5/pgx-install
   Installing Postgres v14.1 to /home/ana/.pgx/14.1/pgx-install
   Installing Postgres v11.14 to /home/ana/.pgx/11.14/pgx-install
   Validating /home/ana/.pgx/10.19/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/11.14/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/12.9/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/13.5/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/14.1/pgx-install/bin/pg_config
ana@autonoma:~/git/zombodb/pgx$ cargo pgx start pg14
    Starting Postgres v14 on port 28814
ana@autonoma:~/git/zombodb/pgx$ cargo pgx init
  Discovered Postgres v14.1, v13.5, v12.9, v11.14, v10.19
  Downloading Postgres v10.19 from https://ftp.postgresql.org/pub/source/v10.19/postgresql-10.19.tar.bz2
  Downloading Postgres v11.14 from https://ftp.postgresql.org/pub/source/v11.14/postgresql-11.14.tar.bz2
  Downloading Postgres v14.1 from https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.bz2
  Downloading Postgres v12.9 from https://ftp.postgresql.org/pub/source/v12.9/postgresql-12.9.tar.bz2
  Downloading Postgres v13.5 from https://ftp.postgresql.org/pub/source/v13.5/postgresql-13.5.tar.bz2
     Removing /home/ana/.pgx/12.9
    Untarring Postgres v12.9 to /home/ana/.pgx/12.9
     Removing /home/ana/.pgx/14.1
    Untarring Postgres v14.1 to /home/ana/.pgx/14.1
     Removing /home/ana/.pgx/11.14
    Untarring Postgres v11.14 to /home/ana/.pgx/11.14
     Removing /home/ana/.pgx/13.5
    Untarring Postgres v13.5 to /home/ana/.pgx/13.5
  Configuring Postgres v12.9
  Configuring Postgres v14.1
  Configuring Postgres v11.14
  Configuring Postgres v13.5
     Removing /home/ana/.pgx/10.19
    Untarring Postgres v10.19 to /home/ana/.pgx/10.19
    Compiling Postgres v12.9
    Compiling Postgres v11.14
    Compiling Postgres v14.1
    Compiling Postgres v13.5
  Configuring Postgres v10.19
    Compiling Postgres v10.19
   Installing Postgres v12.9 to /home/ana/.pgx/12.9/pgx-install
   Installing Postgres v11.14 to /home/ana/.pgx/11.14/pgx-install
   Installing Postgres v13.5 to /home/ana/.pgx/13.5/pgx-install
   Installing Postgres v14.1 to /home/ana/.pgx/14.1/pgx-install
   Installing Postgres v10.19 to /home/ana/.pgx/10.19/pgx-install
   Validating /home/ana/.pgx/10.19/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/11.14/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/12.9/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/13.5/pgx-install/bin/pg_config
   Validating /home/ana/.pgx/14.1/pgx-install/bin/pg_config

@Hoverbear
Copy link
Contributor

@eeeebbbbrrrr and I discussed that this change seems logical and the test failure seems unrelated.

@Hoverbear Hoverbear changed the base branch from master to develop February 4, 2022 21:47
@Hoverbear Hoverbear merged commit c93c1fd into pgcentralfoundation:develop Feb 4, 2022
@Hoverbear Hoverbear mentioned this pull request Feb 9, 2022
@robins robins deleted the env1 branch February 14, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants