fix(gdal): st_read_meta returns empty results for /vsi* paths#775
Open
jatorre wants to merge 1 commit intoduckdb:v1.4-andiumfrom
Open
fix(gdal): st_read_meta returns empty results for /vsi* paths#775jatorre wants to merge 1 commit intoduckdb:v1.4-andiumfrom
jatorre wants to merge 1 commit intoduckdb:v1.4-andiumfrom
Conversation
st_read_meta() uses MultiFileReader to resolve file paths, but
MultiFileReader doesn't understand GDAL virtual filesystem prefixes
(/vsizip/, /vsicurl/, /vsigs/, etc.). It silently returns an empty
file list (due to ALLOW_EMPTY), causing st_read_meta to return 0 rows.
This is inconsistent with st_read(), which bypasses MultiFileReader
for /vsi* paths and passes them directly to GDAL.
The fix detects /vsi* prefixes in the Bind function and creates the
file list directly, matching the behavior of st_read. Non-/vsi paths
continue to use MultiFileReader for glob expansion.
Before: st_read_meta('/vsizip//vsicurl/https://...') → 0 rows
After: st_read_meta('/vsizip//vsicurl/https://...') → full metadata
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jatorre
added a commit
to jatorre/duckdb-spatial
that referenced
this pull request
Mar 19, 2026
…duckdb#776 (KML axis order) Combines two fixes for the CARTO import/export pipeline: 1. st_read_meta: bypass MultiFileReader for /vsi* paths (PR duckdb#775) - Enables pure DuckDB layer discovery on remote files - Eliminates ogrinfo external dependency 2. COPY TO: set OAMS_TRADITIONAL_GIS_ORDER when SRS is provided (PR duckdb#776) - Fixes KML export for coordinates with longitude > 90° - Eliminates ogr2ogr fallback for KML Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jatorre
added a commit
to jatorre/duckdb-spatial
that referenced
this pull request
Mar 19, 2026
…uckdb#775) Based on v1.5-variegata branch (compatible with DuckDB v1.5.0). KML axis order fix (PR duckdb#776) is already in this branch via geometry_always_xy setting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
st_read_meta()silently returns 0 rows when called with GDAL virtual filesystem paths (/vsizip/,/vsicurl/,/vsigs/, etc.). This is because theBindfunction usesMultiFileReader::CreateFileList()which doesn't understand/vsi*prefixes and returns an empty list (masked byALLOW_EMPTY).This is inconsistent with
st_read(), which correctly handles/vsi*paths by passing them directly to GDAL viaGetPrefix().The Fix
When the input path starts with
/vsi, bypassMultiFileReaderand pass the path directly to GDAL — matching the existing behavior ofst_read(). Non-/vsipaths continue to useMultiFileReaderfor glob expansion.Before:
After:
Root Cause
In
gdal_module.cpp, theST_Read_Meta::Bindfunction:MultiFileReader::CreateFileListtries to resolve/vsizip/...through DuckDB's VFS layer, fails, and returns an empty list. TheALLOW_EMPTYflag suppresses the error.Meanwhile,
st_readavoids this by usingGDALClientContextState::GetPrefix()which already has explicit/vsihandling (line 446):Use Case
This enables listing layers in remote archives without downloading them:
Previously the only workaround was calling
ogrinfoas an external process, or downloading the file locally first.Related Issues
st_read_meta)st_read_metacrashes/returns 0 rows for some formatsst_read_meta()crash reports