Jump to content
egnew

Firedac Query Editor in IDE with Postgresql

Recommended Posts

I would like to get the Firedac Query Editor in the IDE to work with Postgresql. 


 When I click the execute button in the Firedac Query Editor, I get this message:

image.thumb.png.c409b37bce3761754bc87e7090b20df7.png

[FireDAC][Phys][PG]-314.  Cannot load vendor library [C:\Prograqm Files\PostgreSQL\17\bin\libpq.dll.  Library has unsupported architecture [x64].  Required [x86] %1 is not a valid Win32 application.  Hint: check it is in the PATH or application EXE directories, and has x86 bitness.

 

The library mentioned is the directory containing the installation for PostgreSQL.  I want to override that and have it use the 32-bit library which is in c:\postgresql\odbc32\bin.

 

My system path begins with c:\postgresql\odbc32\bin; and does not mention the path the IDE is using.  The IDE override path is set to:

$(PUBLIC)\Documents\Embarcadero\InterBase\redist\InterBase2020\IDE_spoof;$(PATH)

 

How do I get the IDE to use the 32-bit library?

 

Thanks

 

 

 

Share this post


Link to post

I mentioned this in another thread. It may help. I don't open database or edit queries in the IDE so it may not.

 

Quote

In my experience, putting libpg.dll and its dependencies in debug\lib and release\lib works and eliminates having to specify a folder in the driver component.

 

Share this post


Link to post

Modern versions of PostgreSQL are only available in 64bit architecture.

The RAD Studio IDE is a 32 bit application. It is not possible to interface to the modern postgreSQL at design time using the IDE.

I have seen examples of people using an old version of the postgreSQL interface dll (a 32 bit version) to talk to modern version of PostgreSQL server. It may work but it cannot be a "guaranteed to work" route since you are asking for a dll to be compatible with a version that wasn't written at the time the dll was created. I've never wasted time trying to get this to work.

Share this post


Link to post

I posted a solution for my non-IDE issue with PostgreSQL drivers at:

https://en.delphipraxis.net/topic/12623-firedac-cannot-load-postgresql-vendor-library/

 

The solution to enable PostgreSQL in the IDE is to do the following:

Go to Tools>Options>Environment Variables>.

Under User System Overrides double click PATH and add the path to your 32-bit and 64-bit PostgreSQL drivers.

 

The updated user system override path on my system:

c:\postgresql\odbc32\bin;c:\postgresql\odbc64\bin;$(PUBLIC)\Documents\Embarcadero\InterBase\redist\InterBase2020\IDE_spoof;$(PATH)

 

I downloaded the 32-bit and 64-bit drivers using Application Stack Builder installed with PostgreSQL database.

 

I will no longer follow this topic as I have provided a simple and effective solution.

Edited by egnew
Discovered issues if you don't include both 32-bit and 64-bit drivers in system override path.

Share this post


Link to post

I did some quick searching about this 32-bit/64-bit client libraries and old version/new version server issue as it relates to PostgreSQL. For the record, here's what Tom Lane (core PostgreSQL developer) has to say:

Screenshot 2024-12-02 090600.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×