Re: Sub:column "" is of type bigint but expression is of type character varying

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rama Krishnan <raghuldrag(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sub:column "" is of type bigint but expression is of type character varying
Date: 2022-08-17 15:25:46
Message-ID: CAKFQuwbs9KueYSB=FqO8BHH6DdHsDdYd1bzuoOQ0ky6B=0m2Xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 17, 2022 at 5:13 AM Rama Krishnan <raghuldrag(at)gmail(dot)com> wrote:

> Hi All,
>
> I am having table name called tickets
>
>
> \d tickets
>
> Column | Type | Collation |
> Nullable | Default
>
> ------------------------------+-----------------------------+-----------+----------+---------
> id | bigint |
> | not null |
> ticket_purchase_no| bigint | |
> not null |
>
> this below table contains more than 2 years old data
> \d tickets_archive
>
> Column | Type | Collation |
> Nullable | Default
>
> ------------------------------+-----------------------------+-----------+----------+---------
> id | bigint |
> | not null |
> ticket_purchase_no| bigint | |
> not null |
>
>
>
>
> i have purged the old data from orginal table when i am restoring the data
> from archive table into orignal table i am getting the error
>
>
> *insert into tickets select * from tickets_archive;*
>
>
> column "*ticket_purchase_no*" is of type bigint but expression is of
> type character varying
>
>
This sequence seems impossible if executed all from the same psql session.
So I presume you most likely aren't actually doing that, and so the psql
output you show is meaningless since it doesn't show what the insert/select
command is actually working with.

If you are, showing the results of "select * from {tickets|tickets_archive}
limit 1" would be informative. Listing columns explicitly in the insert
command and then putting an explicit cast on
tickets_archive.ticket_purchase_no would also be interesting.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2022-08-17 15:59:24 Re: i added Arabic Dictionary but how I know i'm using it
Previous Message Adrian Klaver 2022-08-17 15:07:43 Re: Sub:column "" is of type bigint but expression is of type character varying