Users cannot directly write geospatial data to a Supabase Postgres database using GDAL ogr2ogr because the Postgres role lacks superuser privileges to create the event trigger 'ogr_system_tables_event_trigger_for_metadata'. The solution is to disable GDAL's metadata management by passing the datasource creation option METADATA=OFF.
Origin Analysis
Supabase's managed Postgres does not provide superuser privileges to the 'postgres' role. GDAL's PostgreSQL driver, by default, attempts to create metadata tables and an associated event trigger (ogr_system_tables_event_trigger_for_metadata) to maintain metadata for layers. This operation requires superuser privileges, leading to the warning and failure during direct write.
1. Have a Supabase project with PostGIS enabled.
2. Prepare a GeoJSON file (e.g., campings.geojson).
3. Run the ogr2ogr command: ogr2ogr -f "PostgreSQL" PG:"host=host port=5432 dbname=postgres user=postgres password=password" campings.geojson -nln public.campings
4. Observe the warning: 'User lacks super user privilege to be able to create event trigger ogr_system_tables_event_trigger_for_metadata'.
5. The import fails or the metadata table is not created correctly.
Edge Case Audit
Disabling metadata means GDAL will not store custom layer metadata (e.g., field descriptions, custom coordinate system info) in the database. PostGIS spatial functionality remains intact. If the import partially fails, you may need to manually drop the target table to roll back. Concurrent ogr2ogr imports to different tables are safer with metadata off, but avoid concurrent writes to the same table. To revert, simply remove the -dsco METADATA=OFF option (if superuser privileges are ever granted) or continue using the SQL-file workaround.