D
D
dienerie2020-04-14 10:48:49
PostgreSQL
dienerie, 2020-04-14 10:48:49

How to cast types in postgre?

I made a request that displays all columns with the tinyint type. Displayed a list of columns that can cause problems during the exchange, because. they are most likely in the Postgre database as boolean too. those. they are of type tinyint.

How to bring all types with a script? In the boolean.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2020-04-14
@melkij

There is no tinyint data type in postgresql.
It is impossible to get from the bool number, so the default cast is not implied. If you are interested in the rule 0 - false, everything else is true - then write in the data migration (field != 0). The result will be bool.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question