Re: postgres sql assistance - Mailing list pgsql-general

From Ron Johnson
Subject Re: postgres sql assistance
Date
Msg-id CANzqJaDqAv882tC8B_n2jCMv9GWSTLLbOg+TWHP0xBuPph4=uA@mail.gmail.com
Whole thread Raw
In response to postgres sql assistance  (arun chirappurath <arunsnmimt@gmail.com>)
List pgsql-general
"invalid input syntax for type boolean: "15""

That is the problem.  You can't insert 15 into a column of type "boolean".

On Tue, Jan 16, 2024 at 7:35 AM arun chirappurath <arunsnmimt@gmail.com> wrote:
Dear all,

I am an accidental postgres DBA and learning things every day. Apologies for my questions if not properly drafted.

I am trying to load data from the temp table to the main table and catch the exceptions inside another table.

temp table is cast with the main table data type and trying to load the data.

temp table is below.

    category_name                          |            description                      | is_active
-------------------------------------------+---------------------------------------------+-----------
 Tech123212312312323233213123123123123    | Furniture and home decor                    | true
 Tech123212312312323233213123123123123    | Electronic devices and accessories          | true
 Elec                                    | Books of various genres                     | 15
 TV                                      | Books                                       | 12
 cla                                     | Apparel and fashion accessories             | true

category name is varchar(25) and is_active is boolean in main table. So i should get exceptions for 1st,2nd for category_name rows and 4 and 5th rows for boolean. In exception table results,its only showing 

Exception table is below. Here instead of showing exception for value 12 in the is_active table its showing old exception for 15 itself.. Script is attached,,...SQLERRM value is not getting updated for row 12..WHat could be the reason for this?

value too long for type character varying(25) category_name 1 2024-01-16 16:17:01.279 +0530 value too long for type character varying(25) description 2 2024-01-16 16:17:01.279 +0530 invalid input syntax for type boolean: "15" is_active 3 2024-01-16 16:17:01.279 +0530 invalid input syntax for type boolean: "15" 4 2024-01-16 16:17:01.279 +0530 invalid input syntax for type boolean: "15" 5 2024-01-16 16:17:01.279 +0530

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Tips on troubleshooting slow DELETE (suspect cascades)
Next
From: Ron Johnson
Date:
Subject: Re: Moving to Postgresql database