timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.89k stars 853 forks source link

[Bug]: FATAL: extension "timescaledb" must be preloaded #6809

Closed pedvi closed 3 months ago

pedvi commented 3 months ago

What type of bug is this?

Configuration

What subsystems and features are affected?

Other

What happened?

After following the instructions Install self-hosted TimescaleDB on Windows systems

Setup file run "as administrator", timescaledb-tune run from inside the setup file

postgresql.conf file change accordingly with shared_preload_libraries = 'timescaledb' added in place.

When "Set up the TimescaleDB extension" , and executing CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE I get error "Connection to the server has been lost.".

executing: SET timescaledb.allow_install_without_preload = 'on'; CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; output: ERROR: loader version out-of-date HINT: Please restart the database to upgrade the loader version.

Found other reports with the same issue, but with different (older) combinations of PostgreSql and TimescaleDB

Relevant system information:

Windows 10 Pro PostgreSql 16.2 TimescaleDb 2.14.2

PostgreSql installed via enterprisedb package.

localhost database on a offline system (no internet connection)

TimescaleDB version affected

2.14.2

PostgreSQL version used

16.2

What operating system did you use?

Win10 Pro Build 1909

What installation method did you use?

Other

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

testdb=# CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
FATAL: extension "timescaledb" must be preloaded
HINT: Please preload the timescaledb library via shared_preload_libraries.
This can be done by editing the config file at: /data/patroni2/postgresql.conf
and adding 'timescaledb' to the list in the shared_preload_libraries config.
# Modify postgresql.conf:
shared_preload_libraries = 'timescaledb'
Another way to do this, if not preloading other libraries, is with the command:
echo "shared_preload_libraries = 'timescaledb'" >> /data/postgresql.conf
(Will require a database restart.)
If you REALLY know what you are doing and would like to load the library without preloading, you can disable this check with:
SET timescaledb.allow_install_without_preload = 'on';
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.

How can we reproduce the bug?

basic install following provided instructions at https://docs.timescale.com/self-hosted/latest/install/installation-windows/  

with :
Windows 10 Pro
PostgreSql 16.2  (file: postgresql-16.2-1-windows-x64)
TimescaleDb 2.14.2  (file: timescaledb-postgresql-16-windows-amd64.zip)
erimatnor commented 3 months ago

@pedvi TimescaleDB is tested on Windows so it should work. Double check your configuration.

Note that TimescaleDB requires preloading so the option timescaledb.allow_install_without_preload is legacy and should not be used.

jnidzwetzki commented 3 months ago

Hi @pedvi,

Thanks for reaching out. You mentioned that you added the TimescaleDB loader to the list of preloaded libraries. However, the error message indicates that the loader is not present. The problem often occurs when multiple PostgreSQL configuration files are present. Please check that PostgreSQL uses the correct configuration file by executing SHOW config_file;.

In addition, could you check that your PostgreSQL server was restarted after you added the loader to the configuration file and that the output of SHOW shared_preload_libraries; includes the timescale loader?

test2=# SHOW shared_preload_libraries;

 shared_preload_libraries
--------------------------
 timescaledb
(1 row)
pedvi commented 3 months ago

Thanks @erimatnor and @jnidzwetzki

Problem solved, was exactly that!

There was the conf and auto.conf files, and while the install file (setup.exe) has installed and tunned ( timescaledb-tune) the timescaledb properly in the conf file, there was a previous extension installation (postgis-3) added on the auto.conf file that i overlooked and was forcing the "shared_preload_liubraries" to only preload the auto.conf one.

jnidzwetzki commented 3 months ago

Hi @pedvi,

Thanks for getting back. I'm glad we were able to help. Since the issue is resolved, I am closing this issue.