Re: Confusion on Assert() definition - Mailing list pgsql-general

From Tom Lane
Subject Re: Confusion on Assert() definition
Date
Msg-id 1449617.1742999996@sss.pgh.pa.us
Whole thread Raw
In response to Confusion on Assert() definition  (Егор Будюкин <zhora.budyukin111@gmail.com>)
List pgsql-general
=?UTF-8?B?0JXQs9C+0YAg0JHRg9C00Y7QutC40L0=?= <zhora.budyukin111@gmail.com> writes:
> There's something about the definition of Assert() in postgres that I
> don't really understand.

Asserts are meant to be used for "can't happen" cases that would
represent programming bugs.  As such, they are made to do something
in debug builds but be no-ops in production builds.  If you think
there's actually a realistic chance of the case happening in a
production context, you should use a regular if-test-and-ereport
instead of an Assert.

            regards, tom lane



pgsql-general by date:

Previous
From: Егор Будюкин
Date:
Subject: Confusion on Assert() definition
Next
From: Phillip Diffley
Date:
Subject: Re: Replication slot WAL reservation