pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Changing the Datatype from Bit to Boolean.
6+ messages / 5 participants
[nested] [flat]

* Changing the Datatype from Bit to Boolean.
@ 2025-02-23 05:56  Gambhir Singh <gambhir.singh05@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Gambhir Singh @ 2025-02-23 05:56 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi,

Aurora PostgreSQL DB has a table in which one column has the datatype
BIT(1). Now the requirement is that I have to change the datatype of that
column from BIT to BOOLEAN. There are only a few rows in the table.

-- 
Thanks & Regards
Gambhir Singh

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Changing the Datatype from Bit to Boolean.
@ 2025-02-23 14:13  hellen jiang <hellenjiang99@gmail.com>
  parent: Gambhir Singh <gambhir.singh05@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: hellen jiang @ 2025-02-23 14:13 UTC (permalink / raw)
  To: Gambhir Singh <gambhir.singh05@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

you can add one new column(boolean) and then remove the BIT column。

On Sun, Feb 23, 2025, 12:58 AM Gambhir Singh <gambhir.singh05@gmail.com>
wrote:

>
> Hi,
>
> Aurora PostgreSQL DB has a table in which one column has the datatype
> BIT(1). Now the requirement is that I have to change the datatype of that
> column from BIT to BOOLEAN. There are only a few rows in the table.
>
> --
> Thanks & Regards
> Gambhir Singh
>
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Changing the Datatype from Bit to Boolean.
@ 2025-02-23 14:46  Mark Smith <mark@zoneget.com>
  parent: hellen jiang <hellenjiang99@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Mark Smith @ 2025-02-23 14:46 UTC (permalink / raw)
  To: hellen jiang <hellenjiang99@gmail.com>; Gambhir Singh <gambhir.singh05@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

I am new to PostgreSQL. I am trying to restore a db downloaded from GitHub. Pg_restore is coming with error when tried using pgAdmin.  Can you tell what the reason could be?

Thanks for your help.

Mark

Get Outlook for iOS<https://aka.ms/o0ukef;
________________________________
From: hellen jiang <hellenjiang99@gmail.com>
Sent: Sunday, February 23, 2025 8:13:05 AM
To: Gambhir Singh <gambhir.singh05@gmail.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Changing the Datatype from Bit to Boolean.


you can add one new column(boolean) and then remove the BIT column$B!#(B

On Sun, Feb 23, 2025, 12:58 AM Gambhir Singh <gambhir.singh05@gmail.com<mailto:gambhir.singh05@gmail.com>> wrote:

Hi,

Aurora PostgreSQL DB has a table in which one column has the datatype BIT(1). Now the requirement is that I have to change the datatype of that column from BIT to BOOLEAN. There are only a few rows in the table.

--
Thanks & Regards
Gambhir Singh

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Changing the Datatype from Bit to Boolean.
@ 2025-02-23 15:27  Holger Jakobs <holger@jakobs.com>
  parent: Mark Smith <mark@zoneget.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Holger Jakobs @ 2025-02-23 15:27 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Don't hijack threads!
-- 
Holger Jakobs, Bergisch Gladbach 
Tel. +49 178 9759012

Am 23. Februar 2025 15:46:10 MEZ schrieb Mark Smith <mark@zoneget.com>:
>I am new to PostgreSQL. I am trying to restore a db downloaded from GitHub. Pg_restore is coming with error when tried using pgAdmin.  Can you tell what the reason could be?
>
>Thanks for your help.
>
>Mark
>
>Get Outlook for iOS<https://aka.ms/o0ukef;
>________________________________
>From: hellen jiang <hellenjiang99@gmail.com>
>Sent: Sunday, February 23, 2025 8:13:05 AM
>To: Gambhir Singh <gambhir.singh05@gmail.com>
>Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
>Subject: Re: Changing the Datatype from Bit to Boolean.
>
>
>you can add one new column(boolean) and then remove the BIT column。
>
>On Sun, Feb 23, 2025, 12:58 AM Gambhir Singh <gambhir.singh05@gmail.com<mailto:gambhir.singh05@gmail.com>> wrote:
>
>Hi,
>
>Aurora PostgreSQL DB has a table in which one column has the datatype BIT(1). Now the requirement is that I have to change the datatype of that column from BIT to BOOLEAN. There are only a few rows in the table.
>
>--
>Thanks & Regards
>Gambhir Singh
>

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Changing the Datatype from Bit to Boolean.
@ 2025-02-24 23:54  Mark Smith <mark@zoneget.com>
  parent: Mark Smith <mark@zoneget.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Mark Smith @ 2025-02-24 23:54 UTC (permalink / raw)
  To: Benjamin Acquaye <benjaminacquaye2@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>

Hi Benjamin

Thanks for your help. The script to upload *.sql worked well.

Mark

Get Outlook for iOS<https://aka.ms/o0ukef;
________________________________
From: Benjamin Acquaye <benjaminacquaye2@gmail.com>
Sent: Sunday, February 23, 2025 9:01:44 AM
To: Mark Smith <mark@zoneget.com>
Subject: Re: Changing the Datatype from Bit to Boolean.

Bro, this issue you're encountering with pg_restore could stem from a few different factors,
and some of the common reasons and solutions.

1. Database Format Mismatch
The backup file you're trying to restore might not be in the right format.
PostgreSQL supports several backup formats:

Custom format (.backup): This is often created with pg_dump.
=============
Plain SQL format (.sql): This is a plain text file containing SQL commands.
=================
Directory format: A directory structure, also generated by pg_dump.
=================

Solution:
=========
If you're trying to restore from a .sql file, you should use psql instead of pg_restore.
==========================================================================================
==>psql -U your_user -d your_db_name -f backup.sql

If it's a .backup or directory format, you should use pg_restore. Example:
==========================================================================
==>pg_restore -U your_user -d your_db_name your_backup_file.backup

Solution:
Make sure the user you're logged in as has the appropriate permissions to create objects in the database.

==>GRANT ALL PRIVILEGES ON DATABASE your_db_name TO your_user;

On Sun, Feb 23, 2025 at 9:46 AM Mark Smith <mark@zoneget.com<mailto:mark@zoneget.com>> wrote:
I am new to PostgreSQL. I am trying to restore a db downloaded from GitHub. Pg_restore is coming with error when tried using pgAdmin.  Can you tell what the reason could be?

Thanks for your help.

Mark

Get Outlook for iOS<https://aka.ms/o0ukef;
________________________________
From: hellen jiang <hellenjiang99@gmail.com<mailto:hellenjiang99@gmail.com>>
Sent: Sunday, February 23, 2025 8:13:05 AM
To: Gambhir Singh <gambhir.singh05@gmail.com<mailto:gambhir.singh05@gmail.com>>
Cc: pgsql-admin@lists.postgresql.org<mailto:pgsql-admin@lists.postgresql.org> <pgsql-admin@lists.postgresql.org<mailto:pgsql-admin@lists.postgresql.org>>
Subject: Re: Changing the Datatype from Bit to Boolean.


you can add one new column(boolean) and then remove the BIT column。

On Sun, Feb 23, 2025, 12:58 AM Gambhir Singh <gambhir.singh05@gmail.com<mailto:gambhir.singh05@gmail.com>> wrote:

Hi,

Aurora PostgreSQL DB has a table in which one column has the datatype BIT(1). Now the requirement is that I have to change the datatype of that column from BIT to BOOLEAN. There are only a few rows in the table.

--
Thanks & Regards
Gambhir Singh



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Changing the Datatype from Bit to Boolean.
@ 2025-02-25 11:55  shammat@gmx.net
  parent: Gambhir Singh <gambhir.singh05@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: shammat@gmx.net @ 2025-02-25 11:55 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Gambhir Singh schrieb am 23.02.2025 um 06:56:
> Aurora PostgreSQL DB has a table in which one column has the
> datatype BIT(1). Now the requirement is that I have to change the
> datatype of that column from BIT to BOOLEAN. There are only a few
> rows in the table.
If you store 1 as true and 0 as false, you can use something like this:

alter table the_table
   alter the_column type boolean using (the_column = '1');






^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2025-02-25 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-23 05:56 Changing the Datatype from Bit to Boolean. Gambhir Singh <gambhir.singh05@gmail.com>
2025-02-23 14:13 ` hellen jiang <hellenjiang99@gmail.com>
2025-02-23 14:46   ` Mark Smith <mark@zoneget.com>
2025-02-23 15:27     ` Holger Jakobs <holger@jakobs.com>
2025-02-24 23:54     ` Mark Smith <mark@zoneget.com>
2025-02-25 11:55 ` shammat@gmx.net

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox