Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Migration/Sources/NHost.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ private function convertColumn(array $column, Table $table): Column
required: $column['is_nullable'] === 'NO',
default: $column['column_default'],
array: $isArray,
size: $column['character_maximum_length'] ?? $column['character_octet_length'] ?? 10485760,
size: $column['character_maximum_length'] ?? ($column['data_type'] === 'text' ? 10485760 : ($column['character_octet_length'] ?? 10485760)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 text[] arrays bypass the explicit text branch

For array columns with an underlying text type (e.g. text[]), $column['data_type'] is 'ARRAY', not 'text'. The switch expression uses str_replace('_', '', $column['udt_name']) (so _texttext) which still falls to default, but inside default the condition $column['data_type'] === 'text' evaluates to false. The code then reaches $column['character_octet_length'] ?? 10485760, and since PostgreSQL also leaves character_octet_length null for text arrays, the final value is still 10485760 — so the observable result is correct today. However, the logic is silently inconsistent: text[] takes a different code path than scalar text and would behave differently if character_octet_length were ever populated for arrays. A safer check would test the underlying udt_name as well, e.g. $column['data_type'] === 'text' || ltrim($column['udt_name'] ?? '', '_') === 'text'.

);
}
}
Expand Down