Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ERROR: column t.tags does not exist #885

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

yagagagaga
Copy link
Contributor

When you extrude the vector tiles from OSM data and view it in a browser, an EXCEPTION will be thrown as below:

Caused by: org.apache.baremaps.tilestore.TileStoreException: Failed to execute statement: HikariProxyPreparedStatement@2073309203 wrapping SELECT (SELECT ST_AsMVT(mvtGeom.*, 'building') FROM (SELECT ST_AsMVTGeom(t.geom, ST_TileEnvelope(('14'::int4), ('8198'::int4), ('5447'::int4))) AS geom, t.tags - 'id' AS tags, t.id AS id FROM (SELECT id, tags || jsonb_build_object('building:height', (CASE WHEN tags ->> 'building:levels' ~ '^[0-9\\.]+$' THEN tags ->> 'building:levels' ELSE '1' END)::real * 3), geom FROM osm_ways WHERE tags ? 'building') AS t WHERE t.geom IS NOT NULL AND t.geom && ST_TileEnvelope(('14'::int4), ('8198'::int4), ('5447'::int4), margin => (64.0/4096))) AS mvtGeom) AS mvtTile
	at org.apache.baremaps.tilestore.postgres.PostgresTileStore.read(PostgresTileStore.java:103)
	... 13 more
Caused by: org.postgresql.util.PSQLException: ERROR: column t.tags does not exist
  Position: 120
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194)
	at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:137)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
	at org.apache.baremaps.tilestore.postgres.PostgresTileStore.read(PostgresTileStore.java:96)
	... 13 more

This is because the expression of SQL desires an alias. Maybe it can work well in some special version of Postgre, but for better compatibility, I think a SQL with clear semantics is more highly regarded.

@bchapuis bchapuis merged commit 8dce39f into apache:main Jul 3, 2024
@bchapuis
Copy link
Member

bchapuis commented Jul 3, 2024

Thank you for reviewing this example.

@yagagagaga yagagagaga deleted the fix_20240702 branch July 3, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants