Subject Re: [firebird-support] cannot alter column collate. does it exists in FB 2.0?
Author Paul Vinkenoog
emb_blaster wrote:

> I´m trying this SQL (FB 2.0.4 Win32):
>
> alter table NEW_TABLE
> alter column col_temp
> type varchar(14)
> character set WIN1252
> collate PXW_INTL850
>
> This is the error:
>
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 5, column 1.
> collate.
>
> searching I don´t found that this is not possible. May be I
> misunderstd the docs from interbase60:

Yes, but you are forgiven because it's easy to be misled here.

This is what the IB6 LangRef says about altering colums:

<alt_col_clause> =
{TO new_col_name
| TYPE new_col_datatype
| POSITION new_col_position}

Now, new_col_datatype is not broken down any further, but from what follows under <col_def>:

<col_def> =
col {<datatype> | COMPUTED [BY] (<expr>) | domain}
[DEFAULT {literal | NULL | USER}]
[NOT NULL]
[<col_constraint>]
[COLLATE collation]

...you can gather that COLLATE is not part of the datatype specification.

And from <datatype>:

<datatype> =
...
| {CHAR | CHARACTER | CHARACTER VARYING | VARCHAR} [(int)]
[<array_dim>] [CHARACTER SET charname]
...

...it follows that CHARACTER SET *is* part of the datatype specification.

So the documentation is correct here: IB6 doesn't support a COLLATE clause with ALTER COLUMN -- and neither does Firebird.

But it *is* a shortcoming IMO - maybe you want to add it as a feature request on tracker.firebirdsql.org, if somebody else hasn't already done that.


Regards,
Paul Vinkenoog