Re: Cast INTEGER to BIT confusion

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: "[Quipsy] Markus Karg" <karg(at)quipsy(dot)de>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Cast INTEGER to BIT confusion
Date: 2023-08-16 01:02:30
Message-ID: CAKAnmmK4hp3t9XKjWBWm05SS-mTqnTp1gWiXo1PTrTOP1nd+hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 15, 2023 at 4:49 AM [Quipsy] Markus Karg <karg(at)quipsy(dot)de> wrote:

>
> CREATE TABLE T (c BIT);
>
> INSERT INTO T VALUES (1);
>
> -- I MUST NOT change both lines in any way as these are part of a
> third-party application!
>

That is quite the requirement! I hope that the rest of the application is
more flexible, or you might be fighting an uphill battle for a long time.

However, if the application will drive forward even after an error, you
could pre-create the table "T" the way you want (esp. "c INT"), let the
application's "CREATE TABLE" call fail, and then the subsequent insert(s)
will succeed. Other than that, there is not much that can be easily done,
as the error that is thrown happens pretty early in the process.

Cheers,
Greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-08-16 03:39:25 Re: PostgreSQL and local HDD
Previous Message Peter J. Holzer 2023-08-15 23:43:22 Re: Converting sql anywhere to postgres