HexaCluster LogoHexaCluster Logo
  • Services
  • Products
  • HexaRocket
  • Blog
  • Resources
  • Company
  • Contact Us
Schedule a Demo
Stay Updated

Subscribe to Newsletters

Be the first to know! Stay updated with the latest insights, database migration benchmarks, and technical updates from HexaCluster.

HexaCluster LogoHexaCluster Logo

Enterprise-grade Database migration, modernization, and tooling for teams moving off legacy databases.

  • One Dundas Street West, Suite 2500, Toronto, Ontario, M5G 1Z3, Canada
  • HexaCluster DMCC, Plot No: JLT-PH2-RET-R6 Jumeirah Lakes Towers, Dubai, UAE
connect@hexacluster.ai+1 (902) 221-5976

Security & Compliance

SOC 2 Type 1 reportSOC 2 Type 2 report, monitored by Comp AIGDPR compliantISO 27001AICPA SOC for Service Organizations

Products

  • DMAT
  • HexaRocket
  • HexaBridge
  • HexaTranspile
  • MyBatis2Pg
  • HexaReplicate
  • Download Products

HexaRocket

  • Supported Database Migrations
  • Migrate to Yugabyte
  • About HexaRocket
  • Migrate to Oracle
  • Migrate to PostgreSQL
  • Migrate to MariaDB

Services

  • Database Migration to PostgreSQL
  • Application Migration and Modernization
  • AI/ML and MLOps
  • Architectural Health Audit
  • Managed DBA Services
  • Performance Tuning
  • PostgreSQL Development
  • Training for DBAs & Developers
  • 24/7 Support
  • Supported Tools and Extensions

Company

  • Blog
  • Case Studies
  • Webinars
  • Announcements
  • About Us
  • Referral Program
  • Events
  • Contact Us

© HexaCluster 2026. All rights reserved. Privacy PolicyThis site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

HEXACLUSTERHEXACLUSTERHEXACLUSTER

Oracle’s adoption of Native Boolean Data Type vs PostgreSQL

Pavan Chary
Oct 27, 2025
postgresqlOracle#Oracle#PostgreSQL#boolean+2 more

Oracle has finally introduced support for the Boolean data type in the release 23ai. Many thanks to the Engineers at Oracle for implementing this data type for an optimal performance. PL/SQL had BOOLEAN for decades, but developers were not able to declare native boolean type for columns of tables. For this reason, developers returned VARCHAR2/NUMBER from functions instead of BOOLEAN. Interestingly, PostgreSQL, an open-source relational database that has been widely used for many years and a migration target for Oracle, has had support for Boolean data for more than the past two decades. In this article, we will discuss about the workarounds used by developers before Oracle adopted boolean, and how it works in PostgreSQL.

The Hidden Cost of Simulating True and False

For database engineers and architects designing schemas, it required workarounds to represent "true" or "false" values as 'Y'/'N', 'T'/'F', or 1/0. While these may function adequately on the surface, they may hinder performance. The lack of a native Boolean data type can be a limitation in database design and impact storage efficiency.

image

The Workarounds We Lived With

Before Oracle's recent version 23ai introduced BOOLEAN as the supported datatypes, following were some of the options.

image


Each of them may add redundant conversions and conditions in application code and PL/SQL functions, leading to more CPU work and larger indexes.

🧠 Fine-tune Your PostgreSQL

A quick Architecture Audit can save hours of troubleshooting later.

Try it Now!

🚀 Planning a Database Migration?

Let HexaRocket simplify it - migrate smarter, faster, and stress-free.

Contact us Today!

🚀 Try HexaRocket

HexaRocket performs end-to-end database migrations and replication seamlessly between Oracle, SQL Server, MySQL, MariaDB, and PostgreSQL.

Try Today!

While Oracle took 2 decades to bring this up, PostgreSQL had it forever. Postgres stores Boolean values efficiently (internally as a single byte) and allows direct logical operations as follows.


SELECT * FROM employees WHERE is_active;
UPDATE orders SET is_verified = TRUE WHERE id = 1001;

 

What this clearly means is that it requires - No conversions, no string comparisons, just clean, logical semantics. This approach results in simpler queries, smaller indexes, and faster filtering, especially in analytical workloads with millions of rows.

Following chart demonstrates us the table structure in both Oracle and PostgreSQL, where we can avoid the additional checks in the case of PostgreSQL but not in Oracle.


Oracle Table Structure before 23ai Equivalent PostgreSQL Table Structure
CREATE TABLE user_flags (
   user_id     NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
   is_active   CHAR(1) CHECK (is_active IN ('Y', 'N')),
   is_verified NUMBER(1) CHECK (is_verified IN (0, 1))
);
        
CREATE TABLE user_flags (
   user_id     INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
   is_active   BOOLEAN,
   is_verified BOOLEAN
);
        

Insert Statements

You can directly insert TRUE and FALSE if boolean is supported natively, as seen in the case of PostgreSQL.

Oracle Compatible Insert before 23aiPostgreSQL Compatible Insert
INSERT INTO user_flags (is_active, is_verified)
VALUES ('Y', 1);

INSERT INTO user_flags (is_active, is_verified) VALUES ('N', 0);

INSERT INTO user_flags (is_active, is_verified)
VALUES (TRUE, TRUE);

INSERT INTO user_flags (is_active, is_verified) VALUES (FALSE, FALSE);


Select Statements

You can see simplified and performant select statements as seen in the table below.

OraclePostgreSQL
SQL> SELECT * FROM genericmini_cdc.user_flags 
WHERE is_active = 'Y' AND is_verified = 1;

USER_ID | IS_ACTIVE | IS_VERIFIED --------+-----------+------------ 1 | Y | 1 2 | Y | 1

postgres=# SELECT * FROM user_flags
WHERE is_active AND is_verified;

user_id | is_active | is_verified --------+-----------+------------ 1 | t | t (1 row)


In a nutshell, we can see boolean as the optimal data type over other relevant alternatives. Some of such benefits are listed in the table below.


AspectBOOLEANCHAR(1) / CHAR(5)SMALLINT / NUMBER(1)
MeaningExplicit logical type with TRUE, FALSE, and NULLTextual convention (e.g., 'Y', 'N', 'YES', 'NO')Numeric convention (1 = true, 0 = false)
StorageTypically 1 byte or bit1–5 bytes depending on length and encoding1–2 bytes
Type SafetyAccepts only logical truth valuesMay store invalid text (e.g., 'A', '?')May store non-logical numbers (e.g., 2, -1)
Query SimplicitySupports direct logical operations (AND, NOT, IS TRUE)Requires explicit comparison (='Y')Requires explicit comparison (=1)
Value InterpretationAutomatically interprets TRUE, FALSE, T, F, YES, NO, 1, 0 (case-insensitive)Interpretation depends on convention and case sensitivityLimited to numeric values; cannot represent textual forms
ReadabilitySelf-explanatory and standardizedConvention-dependent and less portableConvention-dependent and less intuitive
Language IntegrationMaps directly to native Boolean typesRequires conversion logicRequires conversion logic

To simplify end-to-end database migrations from Oracle to PostgreSQL, we have announced our tool called Hexarocket. One of the advantages of using this tool is that - during data migration from Oracle to PostgreSQL, it can automatically map CHAR(1) and NUMBER(1) of Oracle to BOOLEAN in PostgreSQL.


Are you looking to migrate from Oracle to PostgreSQL or SQL Server to PostgreSQL? We are here to support with a simple and seamless migration experience within few clicks using HexaRocket. Request us for a demo on HexaRocket today: Schedule a demo.


Authors

Pavan Chary

Pavan Chary

PostgreSQL Database Engineer and Developer

Pavan is a PostgreSQL Database Engineer and Developer at HexaCluster. With expertise in database migrations, performance tuning, and highly scalable PostgreSQL deployments, Pavan is considered one of the most loved PostgreSQL DBA and Developer by the Customers of HexaCluster. His expertise is not limited to PostgreSQL administration, development and migrations. Pavan is a seasoned developer who can build scalable applications using Golang, Java and Python languages.

Start your migration journey 🚀

start your migration journey with our expert team

Products

DMAT

Database & Application Migration Assessment Tool

HexaRocket

End-to-End Database Migration & Modernization Tool

HexaTranspile

Database Code Object Conversion to PostgreSQL

MyBatis2Pg

MyBatis Mapper Conversion to PostgreSQL

HexaReplicate

Enterprise Data Replication & Live CDC

HexaBridge

Oracle Compatibility Layer for PostgreSQL

HexaRocket 🚀

Oracle to PostgreSQLSQL Server to PostgreSQLMySQL to PostgreSQLMariaDB to PostgreSQLAny to Any databases

Migration Services

Database MigrationsApplication Modernization

PostgreSQL Consulting

Architectural AuditsPerformance TuningTraining & Support