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
fix: PostgreSQL compatibility improvements for DataJoint 2.1
Multiple fixes for PostgreSQL backend compatibility:
1. Fix composite FK column mapping in dependencies.py
- Use pg_constraint with unnest() to correctly map FK columns
- Previous information_schema query created Cartesian product
- Fixes "Attribute already exists" errors during key_source
2. Fix Part table full_table_name quoting
- PartMeta.full_table_name now uses adapter.quote_identifier()
- Previously hardcoded MySQL backticks
- Fixes "syntax error at or near `" errors with Part tables
3. Fix char type length preservation in postgres.py
- Reconstruct parametrized types from PostgreSQL info schema
- Fixes char(n) being truncated to char(1) for FK columns
4. Implement HAVING clause subquery wrapping for PostgreSQL
- PostgreSQL doesn't allow column aliases in HAVING
- Aggregation.make_sql() wraps as subquery with WHERE on PostgreSQL
- MySQL continues to use HAVING directly (more efficient)
5. Implement GROUP_CONCAT/STRING_AGG translation
- Base adapter has translate_expression() method
- PostgreSQL: GROUP_CONCAT → STRING_AGG
- MySQL: STRING_AGG → GROUP_CONCAT
- heading.py calls translate_expression() in as_sql()
6. Register numpy type adapters for PostgreSQL
- numpy.bool_, int*, float* types now work with psycopg2
- Prevents "can't adapt type 'numpy.bool_'" errors
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments