Database Development

Why would an integer column not be possible to convert to a text column?

I have an integer column for a table I just created and filled in with data. Now I realize that it would be better if the column is a text type instead of integer. So I tried to change it in pgAdmin 4.

It doesn’t let me.

All it lets me change it to is other number types.

It would be fully understandable if a text column could not be converted to an integer one, because what would "ABC" be turned into numerically? That makes no sense. But this is the other way around! There is no reason that an integer cannot be turned into a text! "123" is a valid text, just like it is a valid integer.

So why doesn’t it let me?

Is this just some idiotic artificial limitation by pgAdmin 4, a bug, or is it PG that prevents this for some reason?

Leave a Reply

Your email address will not be published. Required fields are marked *