Skip to content

ALTER TABLE custom column to string#45

Merged
tomas-villagesql merged 10 commits into
mainfrom
tomas/alter-table-custom-to-string
Feb 24, 2026
Merged

ALTER TABLE custom column to string#45
tomas-villagesql merged 10 commits into
mainfrom
tomas/alter-table-custom-to-string

Conversation

@tomas-villagesql

Copy link
Copy Markdown
Member

No description provided.

@tomas-villagesql tomas-villagesql changed the title support ALTER TABLE converting custom type columns to string ALTER TABLE convert custom column to string Feb 23, 2026
@tomas-villagesql tomas-villagesql force-pushed the tomas/alter-table-custom-to-string branch from 84ed443 to 5c87e68 Compare February 24, 2026 07:31
@tomas-villagesql tomas-villagesql changed the title ALTER TABLE convert custom column to string ALTER TABLE custom column to string Feb 24, 2026
@tomas-villagesql tomas-villagesql force-pushed the tomas/alter-table-custom-to-string branch 4 times, most recently from 99880d8 to 8fac3e5 Compare February 24, 2026 09:17
@tomas-villagesql tomas-villagesql force-pushed the tomas/alter-table-custom-to-string branch from 8fac3e5 to 4188726 Compare February 24, 2026 09:24
Comment thread sql/field_conv.cc
Comment thread villagesql/types/util.cc Outdated
Comment thread villagesql/types/util.cc Outdated
assert(from->has_type_context());
assert(to->result_type() == STRING_RESULT);
// Custom → non-custom string: decode to string representation.
char buff[MAX_FIELD_WIDTH];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be 255*3+1, but what about long vectors? Should we be using MAX_FIELD_WIDTH or something that is from the type context?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is a longer investigation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can put a todo here if you want to check this change in as is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

now uses dynamic string like do_field_string in mysql does

Comment thread villagesql/types/util.cc Outdated
assert(from->has_type_context());
assert(to->result_type() == STRING_RESULT);
// Custom → non-custom string: decode to string representation.
char buff[MAX_FIELD_WIDTH];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can put a todo here if you want to check this change in as is.


UPDATE t1 SET complex_val='(2.0,-3.0)' WHERE id=3;

ALTER TABLE t1 CHANGE complex_val string_val VARCHAR(99) NOT NULL;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Curious why 99 now :-) No need to change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

99, because other is 100, to see which alter ends up in the binlog

Comment thread villagesql/types/util.cc Outdated
@tomas-villagesql tomas-villagesql merged commit 969df14 into main Feb 24, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 24, 2026
@villagestevers villagestevers deleted the tomas/alter-table-custom-to-string branch February 24, 2026 22:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants