Trying to create postgres extension periods returns Cannot load library: unknown error 126 - postgresql

I am currently trying to build a historized database using postgres 12.4.0 and the periods extension. Everything is working fine so far on my Win10Pro X64 machine.
I setup another machine with Win10Pro X64 the same as mine - as far as I can tell:
install postgres
stop postgres service
copy contents of periods release zip https://github.com/xocolatl/periods/releases/download/v1.2/periods-v1.2-pgREL_12_STABLE-windows-x64.zip to postgres/12 dir
start postgres service
now, when I run CREATE EXTENSION IF NOT EXISTS periods CASCADE;, I get the following error only on the other machine:
konnte Bibliothek
»C:/Program Files/PostgreSQL/12/lib/periods.dll« nicht laden: unknown error 126
(in english: could not load library periods.dll)
Everything works fine on my machine
The dll file is there
The required extension btree_gist is there and loadable
How can I fix this?

Found the issue using dependency walker. The periods.dll in that release needs VS2015 debug dlls. My computer had them due to me having the sdk installed.
I needed to copy
vcruntime140d.dll
ucrtbased.dll
to c:\Windows\System32

Related

Postgresql 12 doesn´t find PostGIS extension on CentOS 8

I´m trying to get PostGIS working, but it seems that Postgresql doesn´t find the extension. My server is running on CentOS 8, the Postgresql is version 12. I installed Postgresql 12 first via dnf module enable postgresql:12 etc..
Afterwards I installed PostGIS and followed the description on the PostGIS website (https://people.planetpostgresql.org/devrim/index.php?/archives/102-Installing-PostGIS-3.0-and-PostgreSQL-12-on-CentOS-8.html). But when I try to run CREATE EXTENSION postgis; I get the error ERROR: could not access file "$libdir/postgis-3": No such file or directory SQL state: 58P01 I figured out that the needed files reside in a subdirectory "bitcode". Therefore I tried to symlink the content in the $libdir directory above - but didn´t help. Even copying them in the directory didn´t - same error. What am I missing?
Thank you and best regards,
Goetz
You have a mix of packages installed: Some from the CentOS distribution, some from the PostgreSQL site. That will lead to trouble.
Uninstall the PostgreSQL packages that do not have PGDG in them and make sure to disable them as shown in the link you show. Then install the PGDG packages for PostGIS

postgres odbc connection fails

I am trying to set up a new postgres odbc connection for an application.
This is done on 32-bit Windows 7 system. I installed latest postgresql 9.6 & psqlodbc 0905, and there were no errors. When I add the odbc connection string and test connectivity with postgres login, it fails with the following error:
Test connection failed because of an error in initialized provider.
Specified driver could not be loaded due to system error 182:
(PostgreSQL UNICODE, C:\Program
Files\psqlODBC\0905\bin\psqlodbc35w.dll)
Here's the connection string:
Driver={PostgreSQL
UNICODE};Server=127.0.0.1;Port=5432;Database=postgres;
Uid=postgres;Pwd=postgres;
I then installed Visual C++ redistributable packager versions 2008 and 2010 later. Rebooted the box. Still same issue.
Postgres + odbc + other installs were complete and without any errors.
This is getting too frustrating.
Please.. any ideas on how to fix this will be helpful.?!
Update: I have tested the following:
1. Installed older postgres & psdqlodbc version
2. Added psqlodbc path to PATH env variable at the start
3. Uninstalled standalone psqlodbc installs, and installed Stackbuilder from postgresql package to download and install psqlodbc component.
All of these have not not been any useful.
Final Update: I was able to fix this by using psqlodbc_09_03_0400. For whatever reason, other versions kept throwing error.
Apparently, according to the Microsoft index of error codes, error 182 means ERROR_INVALID_ORDINAL, which with the help of this answer I believe means that the postgresql ODBC driver is loading another DLL and trying to call a function within it that does not exist.
The most likely cause for this would be that the system is loading a wrong version of a DLL on which psqlodbc depends. In fact I found this thread where someone else was having the same issue (although back in 2005).
This could happen if you had installed some other package containing one of the DLLs that psqlodbc relies on, or maybe even another version of psqlodbc.
Try changing the windows search path to put the directory containing the psqlodbc drivers at the front to confirm if this is the case. If that works you might want to try to narrow the problem down until you can find exactly what DLL is conflicting, and if possible remove it.
It is also possible that there is some packaging issue with the psqlodbc package you are using - if that is the case you could try uninstalling that one and installing an earlier version.
Final Update: I was able to fix this by using psqlodbc_09_03_0400. For whatever reason, other versions kept throwing error.

Installing plpythonu on Windows

I'm trying to install plpython on a postgres server on a Windows machine. When I issue the command CREATE EXTENSION plpython3u; in postgres, I get the following error, which I'm trying to find the source of.
ERROR: could not load library "C:/Program Files/PostgreSQL/9.3/lib/plpython3.dll": The specified module could not be found.
This file exists, which I presume means that Windows can't find one of the files it depends on. When I open the plpython3.dll with Dependency Walker, it tells me it can't locate the GPSVC.dll.
Is it likely that this missing dll would cause the CREATE EXTENSION command to fail? I found a .dll with the same name in C:\Windows\System32 and copied it over to C:\Windows\SysWOW64, but this did not resolve the probelm, and although dependency walker now finds the .dll, it raises several other errors about having modules with different CPU types.
I know this is an old question, but thought I would post to save someone the headaches I went through trying to fix this...
I had the same error trying to add pl python using Postgres 9.5. Dependency walker showed that plpython3.dll was looking for python33.dll, so I installed python 3.3 and added the install directory into my path and that seems to have fixed the problem.
Use specific python version on Windows. I could get it running with python 3.2.x with postgres 9.3

PostgreSQL failure on test database for Rails application

Upon running rake db:test:prepare my test database was dropped, but failed to be rebuilt. After researching the errors, I simply attempted to load the database with rake db:test:load to repopulate based on the schema.rb file. That call resulted in the following message
PG::Error: ERROR: could not open extension control file "/usr/pgsql-9.1/share/extension/postgis.control": No such file or directory
I've spent the day reinstalling postgresql-9.1 and postGIS 1.5.3 on a test server in every way I can find on the internet, and none of those installations produce the ever-elusive postgis.control file. Is there a special install I need to run on a CentOS6 machine to produce the binary? Or is there another way to run the rake tasks to test the psql database?
This message is shown for CREATE EXTENSION postgis; however the newer extension method was introduced for PostGIS 2.0. The version that you have installed does not support this method.
Either upgrade to PostGIS 2.0 (excellent RPMs for YUM here), or spatially enable a PostGIS 1.5 database using either a template or using enabler scripts. Details here.

postgresql client library for Lazarus Pascal - missing libpq.dll error

I'm trying to create my first application with Lazarus Pascal and PostgreSQL.
The pg database is on my Ubuntu Linux host. Lazarus is on XP, running through VirtualBox.
When trying to make a connection to the PG database, I get an error that libpq.dll is missing.
What should I do? Pretty new to this platform.
From the docs here http://wiki.lazarus.freepascal.org/postgres
Error: "Can not load PostgreSQL client library "libpq.dll""
The program cannot find your PostgreSQL driver files. Copy all required PostgreSQL .dll/.manifest files either
to your project directory and your executable output directory,
or to a directory in your search path (e.g. c:\windows\system32)
A good example that demonstrates how to include drive DLL files when connecting Lazarus with PostgreSQL under Windows is easyDB.
On Linux/Unix/OSX: make sure the PostgreSQL libraries are in your library search path, e.g.:
On linux add the path to the libpq.so file to the libraries section in your /etc/fpc.cfg file. For example : -Fl/usr/local/pgsql/lib
It may be necessary to create a symbolic link from a specific library version to a general library name:
ln -s /usr/lib/pqsql.so.5 /usr/lib/pqsql.so
. Alternatively, install the postgresql client -dev package using your distribution's package manager