Some of you MAY be able to crack a really tough nut...

I have to move all the data from a PostgreSQL (9.1 - Windows) database to SQL Server because the company I am contracting with is upgrading the old program with a newer .NET version.

The real nut is that the User/Password for Postgres are baked in the old program... Of course the guy who wrote it is gone. No source code or any way to contact him. (Smaaaart)

I was able to obtain the WHOLE Postgres directory (Bin, Data... The whole thing) and I hope it can be done.

Is there a way out of this mess, or should I just blow the contract and look for something else?


  • 4
    What exactly is your question? – a_horse_with_no_name Mar 3 '15 at 6:41
  • What does 'baked' mean? It's hardcoded and then compiled into a binary? How does the lost password issue affect the migration? – dezso Mar 3 '15 at 7:53
  • Correct. User and Password are hardcoded in a compiled program, and the company doesn't have any documentation. Problem is that I'm not all that familiar with Postgres, and I have no clue about how to recover the data, if at all possible. Looks like Postgres definitely wants User/Pass to let me do anything with the data... You think I should just walk away? – Piero Giorgi Mar 3 '15 at 8:49
  • If you have access to the server, read into dba.stackexchange.com/questions/19643/… – dezso Mar 3 '15 at 9:36

I think currently you are not able to log into the postgresql database? If this is the case you can get access of the database by changing the access authorization. Please open pg_hba.conf and change the following line:

local   all             postgres                                md5


local   all             postgres                                peer


local   all             postgres                                trust

Now restart the postgresql service. You should now be able to connect to the database by typing: psql

You can get list of databases by typing: psql -l

  • 1
    I don't think peer will work on a Windows server. – a_horse_with_no_name Mar 3 '15 at 12:34
  • Uh, thank you! Going to try this as soon as I'll be able to start the darn server on the new machine. (The old one has a blown motherboard, so I took the HD from it and copied the whole deal) – Piero Giorgi Mar 4 '15 at 4:04
  • It's getting ridiculous. After 32 years working with all versions of SQL Server and often with MySQL, DB2 and Oracle, I get stonewalled by PostgreSQL!!! WHY can't I restart the server? I'm on a Windows machine, with only one user (The admin). I keep getting "Execution of PostgreSQL by a user with administrative permissions is not permitted. The server must be started under an unprivileged user ID to prevent possible system security compromises. " How can I restart the server, if I only have one user? – Piero Giorgi Mar 15 '15 at 3:22
  • Ok, ok... I got it. Don't run postgres from a CMD with admin privileges. Now I get an error that says " postgres: invalid argument: "Files" " Where do I have to look, now? – Piero Giorgi Mar 15 '15 at 4:25
  • What exact command are you running to restart the server? – user2436428 Mar 16 '15 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.