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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Sub:column "" is of type bigint but expression is of type character varying
Дата
Msg-id CAKFQuwbs9KueYSB=FqO8BHH6DdHsDdYd1bzuoOQ0ky6B=0m2Xg@mail.gmail.com
обсуждение исходный текст
Ответ на Sub:column "" is of type bigint but expression is of type character varying  (Rama Krishnan <raghuldrag@gmail.com>)
Список pgsql-general
On Wed, Aug 17, 2022 at 5:13 AM Rama Krishnan <raghuldrag@gmail.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.


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Sub:column "" is of type bigint but expression is of type character varying
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: i added Arabic Dictionary but how I know i'm using it