Libpq segmentation fault

Hi,
Im trying to use postgres with IslandDb from a darwin console app. I used homebrew to install libpq and I added a symlink

ln -s /opt/homebrew/opt/libpq/lib/libpq.dylib /usr/local/lib/libpq.dylib

so that the console app can find libpq.

I get a segmentation fault when I run the console app.

The code looks like this

namespace IslandDbConsoleApplication;

uses
  RemObjects.Elements.PostgreSQL;

begin
  //writeLn('The magic happens here.');

  var connection := new PostgreSQLDbConnection;

  //  password=password

  var connectionString := 'xxx';
  connection.ConnectionString := connectionString;


  connection.Open;
  connection.Execute('');


end.

I set a breakpoint on open and it never gets to execute.

Im not really sure if just the one symlink was sufficient or its a problem with the island code ?

Cheers,
John

I debugged into the code and it looks like its failing to raise the exception in the open method

      var lConn := ConnectionString.ToAnsiChars(true);
      fHandle := PQconnectdb(@lConn[0]);
      if PQstatus(fHandle) = libpq.ConnStatusType.CONNECTION_BAD then begin
        var lError := String.FromPAnsiChars(PQerrorMessage(fHandle));
        PQfinish(fHandle);
        fHandle := nil;
        raise new PostgreSQLException(lError);
      end;

So the problem was with my dodgy connection string and the code trying to raise the exception.