tedchow
tedchow

Reputation: 195

Cannot open connection after connecting to Postgres 15 using Navicat Premium

I've encountered into a connection issue between PostgreSQL 15 and Navicat 15.

My environment is:

How to produce:

Expected:
Should be able to open the connection.

Actual:
It says the following message on an error dialog.

ERROR: column "datlastsysoid" does not exist
LINE 1: SELECT DISTINCT datlastsysoid FROM pg_database

Upvotes: 15

Views: 27741

Answers (4)

lemon
lemon

Reputation: 340

To supplement the manual fix on macOS, follow these steps:

  1. Open the Navicat application folder and navigate to Contents -> Frameworks.
  2. Locate the file libcc-premium.dylib and create a backup named libcc-premium.dylib.old.
  3. Open the file libcc-premium.dylib with a HEX editor (you can use an online tool such as https://hexed.it/).
  4. Replace datlastsysoid with dattablespace, hex code is 6461747461626c657370616365.
  5. Save the modified file as libcc-premium.dylib and place it back in the original folder.
  6. Use codesign to re-sign the file, otherwise, you won't be able to open the application. Use the following command to sign the file:
    codesign --deep --force --verify --verbose --sign - libcc-premium.dylib
    
  7. After re-signing, open the application, and you should be able to connect successfully.

replace datlastsysoid with dattablespace as shown in the image below.

dattablespace hex code is 6461747461626c657370616365

Upvotes: 4

Soporte Predium
Soporte Predium

Reputation: 21

I had the same problem because they used navicat 15, but as soon as I changed to version 16 that error disappeared. Change version and that's it!

Upvotes: 2

Micha Kaufman
Micha Kaufman

Reputation: 1065

Postgres 15 removed datlastsysoid field from pg_database table, so any version prior to Navicat 15.0.29 or 16.1 will raise this error while looking for this deprecated field.

To fix this, either upgrade to the latest Navicat 15.0.29 or 16.1 and up (might require new license), or do this:

  1. Exit Navcat.
  2. Open Navicat folder (usually under C:\Program Files\PremiumSoft\Navicat....), depends on your Navicat edition
  3. Locate libcc.dll and create a backup of this file (copy and paste it as "libcc-backup.dll" or any other name)
  4. Open this file in any HEX editor, you can use online tool such as https://hexed.it/ if you want.
  5. Search for "SELECT DISTINCT datlastsysoid" in the file, and replace it with "SELECT DISTINCT dattablespace"
  6. Save the file in the original location. If you get any security issues, save it as ".txt" file, and then rename it to ".dll"
  7. That's it! Navicat now works as before. If you have ESET or other security tools, the dll file might be locked for few minutes, for security checkup. Be patient, and try after ~5 min again...

Enjoy!

Upvotes: 36

Logemann
Logemann

Reputation: 2973

The error goes away if you upgrade to latest Navicat version. Version 16.1.5 definitely fixes this issue.

Upvotes: 6

Related Questions