You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The postgres backend has several functions/helpers that check for valid postgres identifiers - for valid table, column, index and view (alias) names - that's used by the different datastore API actions.
However, it doesn't detect when an identifier is greater than postgres' maximum identifier length (63 by default - NAMEDATALEN-1 - unless postgres is compiled with a different NAMEDATALEN setting).
This results in truncated identifiers when database objects are created with overly long identifiers, sometimes resulting in errors.
Steps to reproduce
Create a resource
Create an alias that's longer than 63 characters with datastore_create
Check _table_metadata and the alias is truncated at 63 characters
or
Prepare a CSV file with several column names longer than 63 characters
Upload it to CKAN
Datapusher error because datastore_create fails
Expected behavior
The datastore API should not fail silently and pass the long identifiers to postgres which blindly truncates at 63 characters. It should explicitly return an "identifier too long" error.
The text was updated successfully, but these errors were encountered:
CKAN version
2.9.1
Describe the bug
The postgres backend has several functions/helpers that check for valid postgres identifiers - for valid table, column, index and view (alias) names - that's used by the different datastore API actions.
However, it doesn't detect when an identifier is greater than postgres' maximum identifier length (63 by default -
NAMEDATALEN-1
- unless postgres is compiled with a different NAMEDATALEN setting).https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
This results in truncated identifiers when database objects are created with overly long identifiers, sometimes resulting in errors.
Steps to reproduce
datastore_create
_table_metadata
and the alias is truncated at 63 charactersor
datastore_create
failsExpected behavior
The datastore API should not fail silently and pass the long identifiers to postgres which blindly truncates at 63 characters. It should explicitly return an "identifier too long" error.
The text was updated successfully, but these errors were encountered: