0

After migrating from MySQL to Postgres drush outputs at my Drupal project:

drush cc all
No Drupal site found, only 'drush' cache was cleared.  

The Drupal project works without issues. Connecting to pg db from cli works also.

Command drush sql-connect outputs:

C:\Users\xxx\AppData\Local\Temp\dru4F48.tmp psql -q --dbname=xxx --host=127.0.0.1 --port=5432 --username=postgres --no-align --field-separator=' ' --pset tuples_only=on

System: Win 7 / php5.4.43 / drush 7.3 / postgres 9.3

When I run drush sql-cli, this message is displayed:

command PGPASSFILE is not available

Any ideas?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Remownz
  • 417
  • 1
  • 4
  • 18

1 Answers1

0

As per @Remownz comment, it seems got into Drush bug related to command-line syntax on Windows when passing PostgreSQL's password file (PGPASSFILE). Check related pull requests: #880 and #2973 at GitHub which are attempting to fix it. Try upgrading to Drush 8.x or higher, if won't work, apply the mentioned patches (pull requests).

Here is the link to the bug report: #492 - Drupal 7 on WAMP with PostgreSQL.


Patch file content for Drush 8.x (for manual patch):

--- a/src/Sql/SqlPgsql.php
+++ b/src/Sql/SqlPgsql.php
@@ -41,10 +41,10 @@ private function createPasswordFile()

     public function command()
     {
-        $environment = "";
+        $environment = drush_is_windows() ? "SET " : "";
         $pw_file = $this->createPasswordFile();
         if (isset($pw_file)) {
-            $environment = "PGPASSFILE={$pw_file} ";
+            $environment .= "PGPASSFILE={$pw_file} ";
         }
         return "{$environment}psql -q";
     }
kenorb
  • 155,785
  • 88
  • 678
  • 743