Repository navigation
dbeaver/dbeaver#41239 Map PostgreSQL "char" type to CHAR regardless of type category - #43022
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Thanks for the contribution! |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #41239
Changing a column from
varchar(n)tochar(n)on PostgreSQL 15+ generatedUSING col::char::char(n), which truncates every value to one character. When the user typeschar(10), the base type resolves to the single-byte"char"type (oid 18). PostgreSQL 15 moved that type fromtypcategoryStoZ(internal-use), andPostgreDataType.readDataTypehas no case forZ, so the type gotTypes.OTHER.getConditionTypeCasting()adds an explicit::charcast forOTHERtypes, and PostgreSQL reads a barecharasbpchar(1).Change:
readDataTypemaps oid 18 toTypes.CHARbefore looking at the category, as the branch for servers withouttypcategoryalready does. TheUSINGclause no longer gets the extra cast, so it iscol::char(10)again.Sand mapped toVARCHAR; it is nowCHARthere too, which matches the pre-category branch.PostgreCharDataTypeTest: reads oid 18 with categoryZandSand checks the JDBC type and that no cast is added. Both tests fail before the change (1111and12instead of1).Verification done:
postgres:14andpostgres:17:select oid, typname, typcategory from pg_type where oid = 18returnsSon 14 andZon 17. On 17,alter table t alter column c type char(10) using c::char::char(10)turns'abcdefgh'into'a'.mvn verify -T1C -Pproduct-dbeaver-ce,product-dbeaver-eclipse-ce(withdbeaver-commonanddatadam-apias siblings). All tests inorg.jkiss.dbeaver.ext.postgresql.testpass, including the new ones. Some tests in unrelated modules (SQL parser/completion, cdata, cloudflare d1, and the datadam-api REST client tests) fail in my local setup; they don't touch the PostgreSQL plugin. I haven't run the DBeaver UI against a live server.AI disclosure: this change was investigated, written and verified with an AI coding assistant (Claude).