Drush enable module | not working | Drupal 7 on WAMP with PostgreSQL Based on 
Drush on windows - Command pm-enable needs a higher bootstrap level to run, i have the following question.

I have the same problem found here https://drupal.org/comment/8533097 except I am using Postgresql and this solution did not work for me.

My Drupal installation is at: C:\SiteData\WebDev\gitproject (aka DrupalRoot). I successfully ran drush status in "[DrupalRoot]\sites\site1.example.com, but when I try to enable a module using drush en ccl and I get the following.


  Command pm-enable needs a higher bootstrap level to run - you will
  need to invoke drush from a more functional Drupal environment to run
  this command. The drush command 'en ccl' could not be executed.
  Drush was not able to start (bootstrap) the Drupal database.
  
  Hint: This may occur when Drush is trying to:  
  
  
  bootstrap a site that has not been installed or does not have a  configured database. In this case you can select another site with a 
  working database setup by specifying the URI to use with the --uri 
  parameter on the command line. See drush topic docs-aliases for 
  details.
  connect the database through a socket. The socket file may be wrong or the php-cli  may have no access to it in a jailed shell. See
  http://drupal.org/node/1428638 for details
  
  
  Drush was attempting to connect to:
  
  Drupal version         :  7.26
  Site URI               :  http://site1.example.com
  Database driver        :  pgsql
  Database username      :  user
  Database name          : site1dev
  Default theme          :  garland
  Administration theme   :  garland
  PHP executable         :  php
  PHP configuration      : "C:\Program Files (x86)\Drush\Php\php.ini"
  PHP OS                 :  WINNT
  Drush version          :  6.0
  Drush configuration    :
  Drush alias files      :
  Drupal root            : c:/SiteData/WebDev/gitproject
  Site path              : sites/site1.example.com
  File directory path    : sites/site1.example.com/files


My settings.php file looks like this.

$databases = array (
  'default' =&gt; 
  array (
    'default' =&gt; 
    array (
      'database' =&gt; 'site1dev',
      'username' =&gt; 'user',
      'password' =&gt; 'secretpw',
      'host' =&gt; '127.0.0.1',
      'port' =&gt; '',
      'driver' =&gt; 'pgsql',
      'prefix' =&gt; 'dev_',
    ),
  ),
);


if (php_sapi_name() == 'cli') {
  $db_url = 'pgsql://user:secretpw@127.0.0.1/site1dev';
 }
 else {
   $db_url = 'pgsql://user:secretpw@localhost/site1dev';
 }


I have used both the "Drush Command Prompt" and "MINGW32" git command line tool and both work for "drush status" or "drush dl " but not for "drush en " 

One last comment.  looking at the settings.php file permissions in MINGW32 they show the unix permissions of -rw-r--r--.. Tried changing this in using chmod but doesn't work on a windows file (not even sure that makes a difference).
I'm not on Windows or using postgres today, but I can suggest how to debug:

What you've got right now is that your cli environment seems to be failing to connect to the database correctly.
Checking your database-level access from drush, using verbose (-v) debug (-d) feedback may provide clues.

For instance, given your current failure, I would run 

  drush -v -d sql-cli



that will, among other things, show you the exact database connection command being attempted that is failing. 


You can then copy that yourself, run it again,  and see what variations of that
   command will and will not work. One of the more common issues seems
   to already be covered (the difference between 'localhost' and
   '127.0.0.1' depending on installation and version issues. There may
   be other issues such as 'cannot locate postgres.exe in the current
   $PATH' or whatever.

This is not an answer to the question, but a suggestion on how to get clueful when a (any) drush command just doesn't work. You can also use the -vd flags on your 'en' command, though I don't know how conclusive the feedback you get there will be.