pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rama Krishnan <raghuldrag@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Sub:column "" is of type bigint but expression is of type character varying
Date: Wed, 17 Aug 2022 08:07:43 -0700
Message-ID: <acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com> (raw)
In-Reply-To: <CAJWX+ENJ-Z6Unwru0PR+WBvi4eJjYJay9GPyeCNvXxSBe5Rkmw@mail.gmail.com>
References: <CAJWX+ENJ-Z6Unwru0PR+WBvi4eJjYJay9GPyeCNvXxSBe5Rkmw@mail.gmail.com>

On 8/17/22 01:53, Rama Krishnan wrote:
> Hi All,
> 

> 
> 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;*

The above depends on:

https://www.postgresql.org/docs/current/sql-insert.html

"The target column names can be listed in any order. If no list of 
column names is given at all, the default is all the columns of the 
table in their declared order; or the first N column names, if there are 
only N columns supplied by the VALUES clause or query. The values 
supplied by the VALUES clause or query are associated with the explicit 
or implicit column list left-to-right.
"

If this is not the case then you can get mismatched columns where a 
varchar value is being inserted into an integer field. Verify that the 
table column order is the same for both tables.



> 
> 
>   column "*ticket_purchase_no*" is of type bigint but expression is of 
> type character varying
> Regards
> 
> A.Rama Krishnan


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (4+ messages)  latest in thread

Message-ID: <acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com>
Permalink:  ../acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com/
Also on:    postgresql.org/message-id/acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, raghuldrag@gmail.com
  Subject: Re: Sub:column "" is of type bigint but expression is of type character varying
  In-Reply-To: <acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com>
  References: <CAJWX+ENJ-Z6Unwru0PR+WBvi4eJjYJay9GPyeCNvXxSBe5Rkmw@mail.gmail.com> <acfd5710-933b-29ee-3490-fd694d7ad083@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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