duckdb / postgres_scanner

https://duckdb.org/docs/extensions/postgres
MIT License
227 stars 36 forks source link

Error loading locally installed extension - incompatible metadata but metadata should be correct #223

Closed luisdelatorre012 closed 3 weeks ago

luisdelatorre012 commented 5 months ago

What happens?

I'm trying to download and install the extension locally. When I load the extension, I get an incompatible metadata error message, even though I think I used the correct file. I'm running duckdb 0.10.2 on linux, python 3.11.5.

I downloaded the file from https://extensions.duckdb.org/v0.10.2/linux_amd64_gcc4/postgres_scanner.duckdb_extension.gz.

Installing gives me no error message.

When I use load_extension("postgres") I get the error message

duckdb.duckdb.InvalidInputException: 
Invalid Input Error: 
Extension "/home/<myusername>/.duckdb/extensions/v0.10.2/linux_amd64_gcc4/postgres_scanner.duckdb_extension" 
do not have metadata compatible with DuckDB loading it (version v0.10.2, platform linux_amd64_gcc4)

Am I using the wrong file, or not loading the extension correctly?

To Reproduce

download file: wget https://extensions.duckdb.org/v0.10.2/linux_amd64_gcc4/postgres_scanner.duckdb_extension.gz

then in python:

import duckdb
con = duckdb.connect(config={"allow_unsigned_extensions": "true"})
con.install_extension("postgres_scanner.duckdb_extension.gz")
con.load_extension("postgres")

OS:

Red Hat Enterprise Linux 8.9

PostgreSQL Version:

15.6

DuckDB Version:

0.10.2

DuckDB Client:

Python

Full Name:

Luis de la Torre

Affiliation:

Expeditors

Have you tried this on the latest main branch?

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

Mytherin commented 5 months ago

Try un-gzipping the extension before running .install_extension. Otherwise ensure that PRAGMA version and PRAGMA platform return output aligned with the extension you are downloading.

luisdelatorre012 commented 5 months ago

Thank you! It's working now, but I'm not entirely sure what fixed it because I made too many changes.

I extracted the file, installed and loaded and got the same error. Then I noticed that in ~/.duckdb/extensions I had both v0.10.1 and v0.10.2 folders with postgres_scanner. I deleted both folders, installed again, and the load now works.