Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 17, 2022 at 5:13 AM Rama Krishnan <raghuldrag@xxxxxxxxx> 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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux