![]() We can choose the same datatype in PostgreSQL using the following approach. Replicating a similar behavior in PostgreSQL and in other relational databases is not a complex job. SQL> select ID, ORDER_PROCESSED from ORDER_STATUS WHERE ORDER_PROCESSED IN ('Y','J','T','1') Now, the application might use the following query to determine the orders with status set to ‘Y’ or ‘T’ or ‘J’ or ‘1’. INSERT INTO ORDER_STATUS VALUES (201, 'Z') SQL> INSERT INTO ORDER_STATUS VALUES (201, 'Z') When we insert an invalid record, the insert fails as expected. SQL> INSERT INTO ORDER_STATUS VALUES (200,'Y') When we insert a valid record, the insert is successful. Here, we see a table named : order_status that consists of columns : id and order_processed. Let us consider an example of an Oracle table with a CHAR(1) type and a CHECK constraint as following. We shall discuss how we can perform a seamless transformation of CHAR(1) to boolean datatype while migrating to PostgreSQL. ![]() ![]() This is because Oracle does not support a boolean datatype at SQL level. ![]() In this article, we are going to discuss one such case where there exists a boolean column type but is stored as CHAR(1) with a CHECK constraint in Oracle. For performance benefits, it may be wise to choose the optimal data types supported in PostgreSQL, instead of choosing the same ones as the source, while migrating from another database. PostgreSQL supports a wide variety of data types when compared to a few commercial databases like Oracle. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |