I can't add pgsql PDO Driver in MAMP on Mac Big Sur - postgresql

I have installed MAMP and PostgreSQL with PGAdmin4, but I'm having some problems.
I'm getting a psql "command not found error" in my terminal. I have added export PATH=/Library/PostgreSQL/10/bin:$PATH into ~/.bash_profile, but whenever I reopen the terminal, I get the same error again.
Whenever I try to execute composer or php artisan in my Laravel project I get the below errors, but I'm still able to migrate database:
Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/local/lib/php/pecl/20180731/pdo_pgsql (dlopen(/usr/local/lib/php/pecl/20180731/pdo_pgsql, 9): image not found)
Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/local/lib/php/pecl/20180731/pgsql (dlopen(/usr/local/lib/php/pecl/20180731/pgsql, 9): image not found)
Getting a "driver not found" error whenever trying to browse the project and in PDO Drivers list in phpinfo(), mysql and sqlite available, but pgsql is not available.
MAMP
PostgreSQL 10
PHP: 7.3.21
OS: MAC Big Sur

I had the same issue and when I looked in my php.ini file, I saw that my extensions folder was pointed to the wrong location:
extension_dir = "/Applications/MAMP/bin/php/php7.4.2/lib/php/extensions"
But I don't have a matching directory for php7.4.2 - I use php7.4.9, and confirmed the extension exists in that folder. To fix it for me, I just had to change the above line in my php.ini file to:
extension_dir = "/Applications/MAMP/bin/php/php7.4.9/lib/php/extensions"
And then all was good for me.

Related

rust-lld: error: unable to find library -lpq

I'm trying to build a simple web app using Yew, Diesel, and Postgres. When I run
wasm-pack build --target web --out-name wasm --out-dir ./static
I get the following error:
*rust-lld: error: unable to find library -lpq*
I'm on macOS Catalina. I installed Postgres through Homebrew. My libpq.dylib file is at /usr/local/lib.
These are the troubleshooting I've tried already:
Added /usr/local/lib to $PATH. My pg_config shows LIBDIR = /usr/local/lib.
Re-installed Postgres
Updated rustc -nightly
Ideas here are not helpful as well: How can I link a Rust Wasm application with libpq via wasm-pack?
Still it is not resolved. I'd be grateful for any suggestions.
Libpq does not support the wasm-web platform as far as I'm aware therefore there is no way to make this work. As already mentioned in the comments you probably want to use diesel in your backend code, not in the frontend.

Error creating extension PostGIS in pgAdmin on macOS

I'm trying to install postGIS on my macOS.
I already had postgreSQL and pgAdmin4 installed and I just wanted to install the postGIS extension.
I used stuckbuilder to download it and followed the instructions, then I tried to create a new database on pgAdmin4 and create the extension using the following instruction:
CREATE EXTENSION postgis;
But then I got this error:
ERROR: could not load library "/Library/PostgreSQL/11/lib/postgresql/rtpostgis-2.5.so": dlopen(/Library/PostgreSQL/11/lib/postgresql/rtpostgis-2.5.so, 10): Library not loaded: #loader_path/../../lib/libssl.1.1.dylib
Referenced from: /Library/PostgreSQL/11/lib/postgresql/libgdal.20.dylib
Reason: image not found
What does it means and what can I do to fix it?
I already tried other solutions I found here on stackoverflow, but nothing changed. I hope you can help me.

Could not load library "$libdir/pg_stat_plans" while upgrading 9.3 to 9.4

Library issue while upgrading postgres 9.3.4 to 9.4
I'm trying to upgrade postgres 9.3.4 to postgres 9.4 but im getting below error.
/usr/pgsql-9.4/bin/pg_upgrade --old-bindir=/usr/pgsql-9.3/bin/ --new-bindir=/usr/pgsql-9.4/bin/ --old-datadir=/crpjirw1/postgres1/9.3/data/ --new-datadir=/crpjirw1/postgres1/9.4/data/ --check
Performing Consistency Checks
Checking cluster versions ok
Checking database user is a superuser ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for reg* system OID user data types ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "line" user columns ok
Checking for presence of required libraries fatal
Your installation references loadable libraries that are missing from the
new installation. You can add these libraries to the new installation,
or remove the functions using them from the old installation. A list of
problem libraries is in the file:
loadable_libraries.txt
Failure, exiting
more loadable_libraries.txt
Could not load library "$libdir/pg_stat_plans"
ERROR: could not access file "$libdir/pg_stat_plans": No such file or
directory
i checked in libdir there is no file pg_stat_plans
pg_config --pkglibdir
/usr/pgsql-9.3/lib
cd /usr/pgsql-9.3/lib
ls -lrt pg_stat_plan
ls: cannot access pg_stat_plan*: No such file or directory
I dont understand where its looking for pg_stat_plan lib file.
Someone help me to fix this issue.
I have fixed my issue.
Dropped the pg_stat_plans extension to fix the issue.
There is multiples function will be associated to pg_stat_plans extension
drop extension worked even though there is no extension like pg_stat_plans and it automatically dropped all function and views associated with extension and fixed the issue.
So we have to uninstall the rpm package pg_stat_plans.xxxxx.rpm first and then drop extension and trigger pg_upgrade , it worked for me.

WAMP x64 ext path error

I'm running WAMP 3.0.6 x64 for Windows 10. PHP v 7 is working fine, but from time to time I need to switch back to PHP v 5.6 to test some legacy projects. When I change version via the WAMP icon mysqli stops working. The module is enabled and exists, but the php error log reveals that the wrong ext path is being used:
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.0.10/ext/php_mysqli.dll' - The specified module could not be found.
So WAMP is using the PHP v7 ext directory. I thought this might be related to Winodws ENV variables so I set the following for PATH:
C:\wamp64\bin\php\php5.6.25
Also my wampmanager.conf file has he following set:
phpVersion = "5.6.25"
phpIniDir = "."
phpConfFile = "php.ini"
phpExeDir = "."
I've run out of ideas - anyone able to help?

Postgresql intarray error: undefined symbol: pfree

I'm trying to install Postgresql (8.2.15) additional supplied modules intarray and intagg for my Greenplum database 4.2.1.0. The installation seems successful; I followed the tutorial here and all the files are copied into the greenplumlib-db-4.2.1.0/lib/postgresql share/postgresql directory. but when I tried to execute my java code, it throws an "undefined symbol" error:
org.postgresql.util.PSQLException: ERROR: could not load library "/usr/local/greenplum-db-4.2.1.0/lib/postgresql/_int.so": /usr/local/greenplum-db-4.2.1.0/lib/postgresql/_int.so: undefined symbol: pfree
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:345)
at tuffy.db.RDB.execute(RDB.java:354)
at tuffy.db.RDB.resetSchema(RDB.java:700)
at felix.main.Felix.parseFelixQuery(Felix.java:106)
at felix.main.Felix.run(Felix.java:755)
at felix.main.Main.main(Main.java:69)
saying that the symbol pfree is undefined. I have checked the version number: both the postgresql in Greenplum and the additional module are 8.2.15. Am I missing something?
Update: The link to the tutorial seems unstable; it basically gives some simple steps to complete the installation:
Get any of the postgresql 8.2 source package from the official site
su - gpadmin
Unpack the source, then go to ~/postgresql-8.2.xx/contrib/xxx
make USE_PGXS=1 COPT="-Wno-error" install
(Optional for Greenplum MPP) Use gpssh to copy whatever .so file that just get installed under /usr/local/greenplum-db/lib/postgresql to other nodes
psql -f xxx.sql [DBNAME]
Update:
Thank you for your answer.
I'm installing Greenplum, but it only includes postgresql 8.2.15, so I have to use this version. I have copied the whole /usr/local/pgsql/lib directory to the greenplum library, it seems to get the intarray to work, but now I have a new error:
could not load library "/usr/local/greenplum-db-4.2.1.0/lib/postgresql/plpgsql.so":
/usr/local/greenplum-db-4.2.1.0/lib/postgresql/plpgsql.so: undefined symbol: heap_copytuple
It seems that I'm missing some files...
Thank you!
You may have missed that PostgreSQL 8.2 has reached end of life in 2011.
Upgrade to a more current version, (latest is 9.1 at the time of writing), where installing the extension (formerly: "additional supplied modules") intarray is a matter of:
CREATE EXTENSION intarray;
The manual about CREATE EXTENSION.