Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNFp0-000gB1-22 for pgsql-admin@arkaria.postgresql.org; Wed, 13 May 2026 20:04:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNFoz-00ACPZ-1O for pgsql-admin@arkaria.postgresql.org; Wed, 13 May 2026 20:04:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNFoy-00ACPR-34 for pgsql-admin@lists.postgresql.org; Wed, 13 May 2026 20:04:45 +0000 Received: from mail-westus3azon11020140.outbound.protection.outlook.com ([52.101.201.140] helo=PH7PR06CU001.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wNFow-00000000SJQ-1P35 for pgsql-admin@lists.postgresql.org; Wed, 13 May 2026 20:04:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QvoffsEDwM8sbvLP2TkdzmEym+cMplRcCpId1A7HUy3ulHVNIfhDqX4r3Kn+PqrAKtQBbbGOkbpD5yftnxR1SQcCnWnXTB4yo2pN4OnDColyhc0b555PV/Ap1+bMVYt0dvuwTRCH/kQxWlaa3pc46W6NqoLjeHBXz/dxCHyo1cq73Mi7Y/FoL7wl3iLe2jMKjzUwulhWSEGQGiGkzuzRdroKOJXP7YGSY9haLqZwslMHt+tB01jpHO8HVmx6t0VoPmCcoZz0EsuxVfNb9yGpjhgnLRt3BDUZTo9WMZTlA/pVLC1SC37h2zWy5h5yS8h43lGPpQ2g3BibvhSZnekQDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w4p3c4Y7Lt8UYh6B20KHuYDQs3zgp+aCvbDMo4V/Ve8=; b=n67K2yFql5cvUrIxSZbwefRs94/vXP+sTfjCMok4ynl2Wrb00JSfM8UX/h/Ac8tYRdvlytfofSgYpmgX5vtMmopL8/t6jnpb5PIlz1MXXg/UOCPNyP4vQEqjYAy/TvRu52vvJY9Hd2fL4oL1dYAaNpyDK1j8/hsx/LplB2D+Pe6yAh/14IC+9CWoFx72yp+lZtHgy2CMosRH5cK9Na9hpa/CHI53JwTEzZtB5Xu7LNCbcpEDsh3HJFvG8vZ0wu/aWyLyl9Hq+eqKe6vGecwmbESKXaQtrH1YMJ9rCo7ATEGkra/GiI5u+mPKsWKWsBCHfhCdZWtTTSp2nbvB8s2t1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vishay.com; dmarc=pass action=none header.from=vishay.com; dkim=pass header.d=vishay.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vishay.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w4p3c4Y7Lt8UYh6B20KHuYDQs3zgp+aCvbDMo4V/Ve8=; b=AYkeDGbdIHFqAKdj0aRip6nWQ115x8CanuHs5kJNbMaVDZmefl2D8F9iNH2jq7/AxdteCIGxroFt6mt8Thec3mIjY+Xv9/uf4Kz7BDZZqojtmdY1wDDuONHQg1/bh200CgtE+xcPP9uI1PF733Ts/Nhbpi5rfFwMtMhLDvvoYCNV1K+03ZdxdXfaTrH1cKnWFLLTsmHCXhQ5ici8/Z3IfwVTP0n602/yo9S6WtQjJhjhsWi60Q7p8LSJWGNphk30lhgYJc7XQZHkX4jVFymut0i1GAC5dTxGMC47JH2FEwM3cxO5SehBhc/QwJEWBvnRi4/sfGN7L27Yxxd120nSUg== Received: from LV9PR02MB11231.namprd02.prod.outlook.com (2603:10b6:408:377::23) by PH0PR02MB8678.namprd02.prod.outlook.com (2603:10b6:510:107::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.11; Wed, 13 May 2026 20:04:37 +0000 Received: from LV9PR02MB11231.namprd02.prod.outlook.com ([fe80::d6c3:e8a8:840c:7abc]) by LV9PR02MB11231.namprd02.prod.outlook.com ([fe80::d6c3:e8a8:840c:7abc%6]) with mapi id 15.21.0025.012; Wed, 13 May 2026 20:04:37 +0000 From: "Hajek, Nick" To: Ron Johnson , Pgsql-admin Subject: Re: Puzzling "INSERT has more expressions than target columns" error Thread-Topic: Puzzling "INSERT has more expressions than target columns" error Thread-Index: AQHc4xLFIg5WvPvjNkeo1WPlD3rXybYMYSe4 Date: Wed, 13 May 2026 20:04:37 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_Enabled=True;MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_SiteId=5874b827-1966-41df-a5b7-b79ec04dab64;MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_SetDate=2026-05-13T20:04:37.005Z;MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_Name=Internal Use Only;MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_ContentBits=1;MSIP_Label_c8eddb31-ca59-47b4-aceb-732539ed590b_Method=Standard; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vishay.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV9PR02MB11231:EE_|PH0PR02MB8678:EE_ x-ms-office365-filtering-correlation-id: 5b103038-f41d-489f-a29c-08deb12adc43 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|8096899003|38070700021|18002099003|22082099003|11063799003|3023799003|56012099003|19033499003; x-microsoft-antispam-message-info: URRxRumXFhKz8PtWyyTnMwbG7yZIRCQNTUySgDgEJuhqgd21IMItsAA/B9F7BkhHfSdQp0CEsV2l4XAHLrVLcCbVmlnkSRWNkf6orZX7jByfI69XTD19aI/2W94YucKf71pI1eYhFmprS/+ZXvz521/B7SYMFTeso4mX1HN4BH8KBrvhZlQvA975cskLSGW7YOSZiEHcgk0qG+b9yc6Pxq4SOQZObhnMTe1e2nJwvAODTWjXUdEhGAo5+ELbzYBTQRWCyOnC8P6Qh3BWj99G1qUD0x8H6b6RaCL/OHz6H8JZEBUn2PwCLv2IRhaZoxHPq5Y4VpiFjcipYA/HmRIpzGvl8umjOLy3dSQq8TxvHvGVWGtJjgMRpoVk6PHjvkYIB8FKkeOEbkNRPwaAFMuCILQp6D5d4/Q7nDPk3J/Ihu2EM4Og0K4dkVh9tlLXIoXkBASKgDmeOQ1yqnuRl5URo1ErH5qrsL9cE47QBQc9cRdKcQrmy4Vf/hXhASlSWvShzmRkb5vS+QW+YRLJKwiYjJEa1fQVmbV287EMw3sNcDfYeROS0lEkTXfggXsMlQ8Uoy6sSTPWHJko+mQyrKtXYRMX63xmO2Z1PZOBRBhGZVtoGhsGfc1L278H+TKTsMOf7eOb0rBs9fTTgYZRu07iovnIYjibdxrXtVjsNMpjxOMwjzR8DClAM9d/xV7pn+luHP/j08Qr1pPV3/TpM7DoyXCgwEz7SBDxAmdMGiuIngrWF9laDpW9LntkWisbOH/m x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV9PR02MB11231.namprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(8096899003)(38070700021)(18002099003)(22082099003)(11063799003)(3023799003)(56012099003)(19033499003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TxG9oDc9KvFGiPeCLsLkUI2N/VyXV+NbkE8sVHFFFrOaLV4hqqT0ZQLpYqBo?= =?us-ascii?Q?XAcLL0Ro+QFnE0nTv+ceb5/0ORQlLX6r1HaNVIEE1FWeAV9TzwTM4SCgJiXO?= =?us-ascii?Q?IlhQs+oZ1hVcLZjqZvWgYAiK65rPI3NvedmD87ZUqCnA7NXMLbp/26hv+FYw?= =?us-ascii?Q?h7YnEx+O5DQxtnMVSm/CL4RhlU2VZgY9IZ1mgefLL0/gqX/w4deOpUkA916N?= =?us-ascii?Q?dQzAEXb6HkcK/Jt8AL1XZDYHxcIN4fp47hz/jKvPwpGGc2O+bz7bVu3oumSE?= =?us-ascii?Q?CCiXMmbxqBYD1uP6i6Zxe60uY72acqwuXgCELrAkwQp1+nAz0PfHwBwvRJSg?= =?us-ascii?Q?o8diNdhc0VE+mOyCVNT1O4C8boLNeTgAN6Lpsb6K6jFJ5Ly8HFRtl1LAbtGX?= =?us-ascii?Q?qxRIKSKeq4EWCTG9SUyKuXYnIryiQyCAntfjQZLBNVAhvwKLDQXRfiMLm8F7?= =?us-ascii?Q?siK2KaDCJn6uN6vnmunxh8AN9XKoBrVwn8bnbKtE1Wo6JX3wZGzFdEmxfOfP?= =?us-ascii?Q?2bh7lvsmr10Xuu3Lafeu1TtWfNzKe4Jw0f6iGKvrmglMccNA9EsnBCl74NUi?= =?us-ascii?Q?TaCzWwQIlTXlc9pFiEqaLMRSB85O5wMYzas6wCrLFHCVHVWJ1NCo+Lqkglse?= =?us-ascii?Q?PQK8xGYLQ80tMPY6OuE5sY7Egr3dgx+FwTcFmYIsWQtAOT12D5EkZkxZ3Nh9?= =?us-ascii?Q?Qvw7vtQFO3JslYhlmxOA5arvuO7QbLJ4dgVG43uFF9x6XRggY+UKkZm5pSyF?= =?us-ascii?Q?diAxQQvsxLeBG4JUJJf6v2L5XWv9wTOK/TdOcSQDEKpuQvgGX6ryWbpGwLki?= =?us-ascii?Q?Bd68/HnLjCCWDDaUPE1KgUFNv9RTwMFEPF6PG09mN59fQxw78To+iHWZmZXS?= =?us-ascii?Q?7kcq6XoUrzbsQFm7VMM/+OgXqX/vtMvgCxc/dLuVhVEk8GDuH2YS42bc4LZE?= =?us-ascii?Q?rqwSceGjZ/o9VFlFTAxoXKUnvoxzfI3BSUsMQYjWbTmT/0IumYDPdzoBrPoS?= =?us-ascii?Q?jZfsD0iYBxj1Amm3G0QWv1GWSt2jhgQRu7ZPCCe4rr36tzJmngqa0i1G1jb/?= =?us-ascii?Q?23/FVdFegugYQT0Wy+6pLqJCiqVWlURmgGBgA0qT70m/FeiKpzRMYh/2dspX?= =?us-ascii?Q?U1o6UnBukc9MemmN3EMWWN/4PG/OwBkYA/+GZjEUlrzfeGzlkZwnPrqppP/N?= =?us-ascii?Q?HOA0oT7yCh/qJXSHkj3wwYbzaHT759VpXGgCSfsxkiLtN5eH+9996BDk9ZAR?= =?us-ascii?Q?VlDRsg2nbYtjqjdKh6JDZrDehe/pcJLiqe1e/bHrgesh3AeXyaHxHfXlCtr3?= =?us-ascii?Q?WhICCKQyatAI868/8mnX/aGi0dphq7ZfhV6lHcyCi7LVXtN4EvVrAQQUmAVd?= =?us-ascii?Q?0U3FyPnVR13Hb83wwHnNWSVK+r+Gh6XkTyampph5kqUPzCFCQEn5TVUYJbxx?= =?us-ascii?Q?BgOTnaNQhG+Z3VoH2gjudmqdZUPD+/5gwZInwOnbaGoPGmYVn3POgc8dzUX/?= =?us-ascii?Q?sP4Q3zuhsKn/9qZNddMCTov2HCpqtwa0PiWRwAxAXxkl8DfKMwcumcwHdRd+?= =?us-ascii?Q?IMmJaKfUiUELtVu2uB9IlI2O4LqWbmi3A4TyRVW41VCNIf9p9f19k2r6Vn03?= =?us-ascii?Q?pm6iqMg5jnfvko5dH+oV2fZe+MGUf7if+zFD5vy0whRK70qTmkbmCRY+J2BY?= =?us-ascii?Q?vbMwQ09X/hQi7V462fXIHvmpBePcq8AIqaESPN4IaCsKXHmd?= Content-Type: multipart/alternative; boundary="_000_LV9PR02MB11231E84BBAF4D4357A94D86CE5062LV9PR02MB11231na_" MIME-Version: 1.0 X-OriginatorOrg: vishay.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV9PR02MB11231.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b103038-f41d-489f-a29c-08deb12adc43 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2026 20:04:37.4647 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5874b827-1966-41df-a5b7-b79ec04dab64 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NJK6nBLzDGVXGGFoKJNcOl/A7QAW33i1fdrpqGDfVouyJgZdn/670FzkVqUizUiBAwwBSd6G6gVfxANSHeFRQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB8678 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_LV9PR02MB11231E84BBAF4D4357A94D86CE5062LV9PR02MB11231na_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You're inserting into a table named lockbox but I don't see the schema for = lockbox anywhere in your post. Nick ________________________________ From: Ron Johnson Sent: Wednesday, May 13, 2026 2:57 PM To: Pgsql-admin Subject: Puzzling "INSERT has more expressions than target columns" error [ External Email ] PG 17.9 I imported a foreign schema, and then wanted to create a local copy. Thus: TAPb=3D# CREATE TABLE l_tap35.batch (LIKE f_tap35.batch EXCLUDING ALL); CREATE TABLE But then: TAPb=3D# INSERT INTO l_tap35.lockbox SELECT * FROM f_tap35.batch; ERROR: INSERT has more expressions than target columns LINE 1: INSERT INTO l_tap35.lockbox SELECT * FROM f_tap35.batch; ^ Ok, maybe the sequence on the PK field is causing a problem? But that doesn't seem to be the case. TAPb=3D# select count(*) from pg_attribute where attrelid =3D (SELECT oid FROM pg_class where relname =3D 'batch' AND relnamespace::regnamespace::text =3D 'f_tap35') TAPb-# AND attnum > 0; count ------- 132 (1 row) TAPb=3D# select count(*) from pg_attribute where attrelid =3D (SELECT oid FROM pg_class where relname =3D 'batch' AND relnamespace::regnamespace::text =3D 'l_tap35') AND attnum > 0; count ------- 132 (1 row) TAPb=3D# SELECT f.attname, f.attnum, f.atttypid, (f.attname =3D l.attname),= (f.atttypid =3D l.atttypid) FROM (select attname, attnum, atttypid, attidentity, attgenerated from pg_attribute where attrelid =3D (SELECT oid FROM pg_class where relname =3D 'batch' AND relnamespace::regnamespace::text =3D 'f_tap35')= ) f , (select attname, attnum, atttypid, attidentity, attgenerated from pg_attribute where attrelid =3D (SELECT oid FROM pg_class where relname =3D 'batch' AND relnamespace::regnamespace::text =3D 'l_tap35')= ) l WHERE f.attnum =3D l.attnum AND f.attnum > 0 ORDER BY f.attnum; attname | attnum | atttypid | ?column? | = ?column? ------------------------------------------+--------+----------+----------+-= --------- batch_id | 1 | 20 | t | = t number | 2 | 20 | t | = t batch_file_type_code_id | 3 | 20 | t | = t import_status_code_id | 4 | 20 | t | = t batch_identifier | 5 | 1043 | t | = t paired_batch_id | 6 | 20 | t | = t file_sequence_number | 7 | 1700 | t | = t start_time | 8 | 1114 | t | = t export_time | 9 | 1114 | t | = t balanced | 10 | 1043 | t | = t deposit_time | 11 | 1114 | t | = t check_count | 12 | 1700 | t | = t check_total | 13 | 1700 | t | = t doc_count | 14 | 1700 | t | = t credit_date | 15 | 1114 | t | = t invoice_total | 16 | 1700 | t | = t invoice_count | 17 | 1700 | t | = t batch_limit | 18 | 1700 | t | = t association_type | 19 | 1043 | t | = t truncation_flag | 20 | 16 | t | = t eod_status | 21 | 1043 | t | = t ocr_count | 22 | 1700 | t | = t unprocessable_items | 23 | 1700 | t | = t no_check_items | 24 | 1700 | t | = t non_systemic_character_count | 25 | 20 | t | = t systemic_character_count | 26 | 20 | t | = t repair_count | 27 | 20 | t | = t doctus_page_count | 28 | 1700 | t | = t front_image_count | 29 | 1700 | t | = t rear_image_count | 30 | 1700 | t | = t front_ocr_count | 31 | 1700 | t | = t rear_ocr_count | 32 | 1700 | t | = t batch_status | 33 | 1700 | t | = t doctus_character_count | 34 | 20 | t | = t stop_check_count | 35 | 1700 | t | = t bank_name | 36 | 1043 | t | = t affiliate | 37 | 1043 | t | = t pass1_mach_no | 38 | 1700 | t | = t zip_filename | 39 | 1043 | t | = t image_path | 40 | 1043 | t | = t lockbox_id | 41 | 20 | t | = t site_code_id | 42 | 20 | t | = t batch_mode_code_id | 43 | 20 | t | = t processing_bank_id | 44 | 1700 | t | = t weekend_reporting_date | 45 | 1082 | t | = t cds_deposit_time | 46 | 1043 | t | = t cds_file_create_time | 47 | 1043 | t | = t cds_archive_time | 48 | 1114 | t | = t check_21_count | 49 | 1700 | t | = t check_21_total | 50 | 1700 | t | = t arc_count | 51 | 1700 | t | = t arc_total | 52 | 1700 | t | = t arc_suspect_count | 53 | 1700 | t | = t arc_suspect_total | 54 | 1700 | t | = t pending_count | 55 | 1700 | t | = t pending_total | 56 | 1700 | t | = t duplicate_count | 57 | 1700 | t | = t duplicate_total | 58 | 1700 | t | = t item_state | 59 | 1700 | t | = t arc_status | 60 | 1700 | t | = t cds_batch_number | 61 | 20 | t | = t cds_full_batch_number | 62 | 20 | t | = t rebatching_source | 63 | 1043 | t | = t rebatching_rule | 64 | 1043 | t | = t coupon_count | 65 | 1700 | t | = t correspondence_count | 66 | 1700 | t | = t envelope_count | 67 | 1700 | t | = t cds_system_time | 68 | 1114 | t | = t cds_cut_off_date | 69 | 1082 | t | = t work_flow | 70 | 1700 | t | = t inbound_batch_number | 71 | 1043 | t | = t inbound_file_name | 72 | 1043 | t | = t inbound_receipt_time | 73 | 1114 | t | = t third_party_provider | 74 | 1043 | t | = t mail_out_state | 75 | 1700 | t | = t exported_on | 76 | 1114 | t | = t aux_on_us | 77 | 1043 | t | = t tms_check_count | 78 | 1700 | t | = t tms_check_total | 79 | 1700 | t | = t tms_invoice_total | 80 | 1700 | t | = t tms_invoice_count | 81 | 1700 | t | = t retention_date | 82 | 1082 | t | = t archive_front_check_image_count | 83 | 1700 | t | = t archive_rear_check_image_count | 84 | 1700 | t | = t archive_front_invoice_image_count | 85 | 1700 | t | = t archive_rear_invoice_image_count | 86 | 1700 | t | = t archive_front_coupon_image_count | 87 | 1700 | t | = t archive_rear_coupon_image_count | 88 | 1700 | t | = t archive_front_correspondence_image_count | 89 | 1700 | t | = t archive_rear_correspondence_image_count | 90 | 1700 | t | = t archive_front_envelope_image_count | 91 | 1700 | t | = t archive_rear_envelope_image_count | 92 | 1700 | t | = t backload_manifest_id | 93 | 20 | t | = t cds_weekend_reporting_date | 94 | 1082 | t | = t batch_output_type | 95 | 1700 | t | = t bank_retention_on | 96 | 1114 | t | = t customer_retention_on | 97 | 1114 | t | = t lockbox_retention_on | 98 | 1114 | t | = t arc_weekend_reporting_date | 99 | 1082 | t | = t virutal_endorsement_date | 100 | 1082 | t | = t capture_source | 101 | 1700 | t | = t consolidation_number | 102 | 1043 | t | = t doc_group | 103 | 1700 | t | = t deposit_tran_code | 104 | 1043 | t | = t deposit_rt_number | 105 | 1043 | t | = t retry_count | 106 | 1700 | t | = t doc_archive_img_count_exclude_no_image | 107 | 1700 | t | = t processing_date_number | 108 | 1043 | t | = t ocr_item_state | 109 | 1700 | t | = t ocr_started_on | 110 | 1114 | t | = t ocr_finished_on | 111 | 1114 | t | = t ems_cutoff_time | 112 | 1114 | t | = t watchlist_item_state | 113 | 1700 | t | = t rdc_number | 114 | 20 | t | = t rdc_created_on | 115 | 1114 | t | = t rdc_created_by | 116 | 20 | t | = t holdover_period | 117 | 1700 | t | = t holdover_count | 118 | 1700 | t | = t custom_userfield_234 | 119 | 1700 | t | = t custom_userfield_235 | 120 | 1700 | t | = t custom_userfield_236 | 121 | 1700 | t | = t custom_userfield_237 | 122 | 1700 | t | = t custom_userfield_238 | 123 | 1700 | t | = t custom_userfield_239 | 124 | 1700 | t | = t custom_userfield_240 | 125 | 1043 | t | = t custom_userfield_241 | 126 | 1043 | t | = t created_on | 127 | 1114 | t | = t created_by | 128 | 20 | t | = t modified_on | 129 | 1114 | t | = t modified_by | 130 | 20 | t | = t process_date | 131 | 1082 | t | = t partition_type | 132 | 1700 | t | = t (132 rows) There are 132 columns in the foreign table and the local copy, all column n= ames match, data types match, and the remote table does not have any genera= ted columns. I'm certainly overlooking something but don't see it. Thanks -- Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --_000_LV9PR02MB11231E84BBAF4D4357A94D86CE5062LV9PR02MB11231na_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
You're inserting into a table named lockbox but I don't see the schema for = lockbox anywhere in your post.

Nick

From: Ron Johnson <ronlj= ohnsonjr@gmail.com>
Sent: Wednesday, May 13, 2026 2:57 PM
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Puzzling "INSERT has more expressions than target colu= mns" error
 
[ External Email ]
PG 17.9

I imported a foreign schema, and then wanted to create a local copy.&n= bsp; Thus:

TAPb=3D# CREATE TABLE l_tap35.batch (LIKE f_t= ap35.batch EXCLUDING ALL);
CREATE TABLE

But then:

TAPb=3D# INSERT INTO l_tap35.lockbox SELECT *= FROM f_tap35.batch;
ERROR:  INSERT has more expressions than target columns
LINE 1: INSERT INTO l_tap35.lockbox SELECT * FROM f_tap35.batch;
                     = ;                     &nb= sp;^
Ok, maybe the sequence on the PK field is causing a problem?

But that doesn't seem to be the case.

TAPb=3D# select count(*)
from pg_attribute
where attrelid =3D (SELECT oid
                 FROM pg_class=
                 where relname= =3D 'batch'
                 AND relnamesp= ace::regnamespace::text =3D 'f_tap35')
TAPb-#   AND attnum > 0;
 count
-------
   132
(1 row)

TAPb=3D# select count(*)
from pg_attribute
where attrelid =3D (SELECT oid
                 FROM pg_class=
                 where relname= =3D 'batch'
                 AND relnamesp= ace::regnamespace::text =3D 'l_tap35')
  AND attnum > 0;
 count
-------
   132
(1 row)

TAPb=3D# SELECT f.attname, f.attnum, f.atttyp= id, (f.attname =3D l.attname), (f.atttypid =3D l.atttypid)
FROM (select attname, attnum, atttypid, attidentity, attgenerated
      from pg_attribute
      where attrelid =3D (SELECT oid
                     = ;   FROM pg_class
                     = ;   where relname =3D 'batch'
                     = ;   AND relnamespace::regnamespace::text =3D 'f_tap35')) f
   , (select attname, attnum, atttypid, attidentity, attgenerated=
      from pg_attribute
      where attrelid =3D (SELECT oid
                     = ;   FROM pg_class
                     = ;   where relname =3D 'batch'
                     = ;   AND relnamespace::regnamespace::text =3D 'l_tap35')) l
WHERE f.attnum =3D l.attnum
  AND f.attnum > 0
ORDER BY f.attnum;
                 attname  = ;                | attnum | atttypi= d | ?column? | ?column?
------------------------------------------+--------+----------+----------+-= ---------
 batch_id                 &nbs= p;               |      1= |       20 | t        | t
 number                  =                 |     &n= bsp;2 |       20 | t        | t
 batch_file_type_code_id             &nb= sp;    |      3 |       20 | t &nbs= p;      | t
 import_status_code_id              = ;      |      4 |       20 | t=        | t
 batch_identifier               &nb= sp;         |      5 |     104= 3 | t        | t
 paired_batch_id               &nbs= p;          |      6 |    = ;   20 | t        | t
 file_sequence_number              =       |      7 |     1700 | t &nbs= p;      | t
 start_time                 &n= bsp;             |      8 | &n= bsp;   1114 | t        | t
 export_time                 &= nbsp;            |      9 | &n= bsp;   1114 | t        | t
 balanced                 &nbs= p;               |     10 | &n= bsp;   1043 | t        | t
 deposit_time                 =             |     11 |    = ; 1114 | t        | t
 check_count                 &= nbsp;            |     12 |   =   1700 | t        | t
 check_total                 &= nbsp;            |     13 |   =   1700 | t        | t
 doc_count                 &nb= sp;              |     14 | &n= bsp;   1700 | t        | t
 credit_date                 &= nbsp;            |     15 |   =   1114 | t        | t
 invoice_total                =            |     16 |    = ; 1700 | t        | t
 invoice_count                =            |     17 |    = ; 1700 | t        | t
 batch_limit                 &= nbsp;            |     18 |   =   1700 | t        | t
 association_type               &nb= sp;         |     19 |     1043 | t=        | t
 truncation_flag               &nbs= p;          |     20 |     &nb= sp; 16 | t        | t
 eod_status                 &n= bsp;             |     21 |   =   1043 | t        | t
 ocr_count                 &nb= sp;              |     22 | &n= bsp;   1700 | t        | t
 unprocessable_items               =        |     23 |     1700 | t &nbs= p;      | t
 no_check_items                = ;           |     24 |     170= 0 | t        | t
 non_systemic_character_count            = ; |     25 |       20 | t       &nb= sp;| t
 systemic_character_count             &n= bsp;   |     26 |       20 | t     =    | t
 repair_count                 =             |     27 |    = ;   20 | t        | t
 doctus_page_count               &n= bsp;        |     28 |     1700 | t=        | t
 front_image_count               &n= bsp;        |     29 |     1700 | t=        | t
 rear_image_count               &nb= sp;         |     30 |     1700 | t=        | t
 front_ocr_count               &nbs= p;          |     31 |     170= 0 | t        | t
 rear_ocr_count                = ;           |     32 |     170= 0 | t        | t
 batch_status                 =             |     33 |    = ; 1700 | t        | t
 doctus_character_count             &nbs= p;     |     34 |       20 | t   &n= bsp;    | t
 stop_check_count               &nb= sp;         |     35 |     1700 | t=        | t
 bank_name                 &nb= sp;              |     36 | &n= bsp;   1043 | t        | t
 affiliate                 &nb= sp;              |     37 | &n= bsp;   1043 | t        | t
 pass1_mach_no                =            |     38 |    = ; 1700 | t        | t
 zip_filename                 =             |     39 |    = ; 1043 | t        | t
 image_path                 &n= bsp;             |     40 |   =   1043 | t        | t
 lockbox_id                 &n= bsp;             |     41 |   =     20 | t        | t
 site_code_id                 =             |     42 |    = ;   20 | t        | t
 batch_mode_code_id               &= nbsp;       |     43 |       20 | t=        | t
 processing_bank_id               &= nbsp;       |     44 |     1700 | t &nbs= p;      | t
 weekend_reporting_date             &nbs= p;     |     45 |     1082 | t     =    | t
 cds_deposit_time               &nb= sp;         |     46 |     1043 | t=        | t
 cds_file_create_time              =       |     47 |     1043 | t   &n= bsp;    | t
 cds_archive_time               &nb= sp;         |     48 |     1114 | t=        | t
 check_21_count                = ;           |     49 |     170= 0 | t        | t
 check_21_total                = ;           |     50 |     170= 0 | t        | t
 arc_count                 &nb= sp;              |     51 | &n= bsp;   1700 | t        | t
 arc_total                 &nb= sp;              |     52 | &n= bsp;   1700 | t        | t
 arc_suspect_count               &n= bsp;        |     53 |     1700 | t=        | t
 arc_suspect_total               &n= bsp;        |     54 |     1700 | t=        | t
 pending_count                =            |     55 |    = ; 1700 | t        | t
 pending_total                =            |     56 |    = ; 1700 | t        | t
 duplicate_count               &nbs= p;          |     57 |     170= 0 | t        | t
 duplicate_total               &nbs= p;          |     58 |     170= 0 | t        | t
 item_state                 &n= bsp;             |     59 |   =   1700 | t        | t
 arc_status                 &n= bsp;             |     60 |   =   1700 | t        | t
 cds_batch_number               &nb= sp;         |     61 |       2= 0 | t        | t
 cds_full_batch_number              = ;      |     62 |       20 | t &nbs= p;      | t
 rebatching_source               &n= bsp;        |     63 |     1043 | t=        | t
 rebatching_rule               &nbs= p;          |     64 |     104= 3 | t        | t
 coupon_count                 =             |     65 |    = ; 1700 | t        | t
 correspondence_count              =       |     66 |     1700 | t   &n= bsp;    | t
 envelope_count                = ;           |     67 |     170= 0 | t        | t
 cds_system_time               &nbs= p;          |     68 |     111= 4 | t        | t
 cds_cut_off_date               &nb= sp;         |     69 |     1082 | t=        | t
 work_flow                 &nb= sp;              |     70 | &n= bsp;   1700 | t        | t
 inbound_batch_number              =       |     71 |     1043 | t   &n= bsp;    | t
 inbound_file_name               &n= bsp;        |     72 |     1043 | t=        | t
 inbound_receipt_time              =       |     73 |     1114 | t   &n= bsp;    | t
 third_party_provider              =       |     74 |     1043 | t   &n= bsp;    | t
 mail_out_state                = ;           |     75 |     170= 0 | t        | t
 exported_on                 &= nbsp;            |     76 |   =   1114 | t        | t
 aux_on_us                 &nb= sp;              |     77 | &n= bsp;   1043 | t        | t
 tms_check_count               &nbs= p;          |     78 |     170= 0 | t        | t
 tms_check_total               &nbs= p;          |     79 |     170= 0 | t        | t
 tms_invoice_total               &n= bsp;        |     80 |     1700 | t=        | t
 tms_invoice_count               &n= bsp;        |     81 |     1700 | t=        | t
 retention_date                = ;           |     82 |     108= 2 | t        | t
 archive_front_check_image_count          | &= nbsp;   83 |     1700 | t        | t
 archive_rear_check_image_count           | &= nbsp;   84 |     1700 | t        | t
 archive_front_invoice_image_count        |  =   85 |     1700 | t        | t
 archive_rear_invoice_image_count         |  =   86 |     1700 | t        | t
 archive_front_coupon_image_count         |  =   87 |     1700 | t        | t
 archive_rear_coupon_image_count          | &= nbsp;   88 |     1700 | t        | t
 archive_front_correspondence_image_count |     89 |   =   1700 | t        | t
 archive_rear_correspondence_image_count  |     90 | &n= bsp;   1700 | t        | t
 archive_front_envelope_image_count       |   &nbs= p; 91 |     1700 | t        | t
 archive_rear_envelope_image_count        |  =   92 |     1700 | t        | t
 backload_manifest_id              =       |     93 |       20 | t &nbs= p;      | t
 cds_weekend_reporting_date             =   |     94 |     1082 | t       &nb= sp;| t
 batch_output_type               &n= bsp;        |     95 |     1700 | t=        | t
 bank_retention_on               &n= bsp;        |     96 |     1114 | t=        | t
 customer_retention_on              = ;      |     97 |     1114 | t   &n= bsp;    | t
 lockbox_retention_on              =       |     98 |     1114 | t   &n= bsp;    | t
 arc_weekend_reporting_date             =   |     99 |     1082 | t       &nb= sp;| t
 virutal_endorsement_date             &n= bsp;   |    100 |     1082 | t      = ;  | t
 capture_source                = ;           |    101 |     170= 0 | t        | t
 consolidation_number              =       |    102 |     1043 | t   &n= bsp;    | t
 doc_group                 &nb= sp;              |    103 | &n= bsp;   1700 | t        | t
 deposit_tran_code               &n= bsp;        |    104 |     1043 | t=        | t
 deposit_rt_number               &n= bsp;        |    105 |     1043 | t=        | t
 retry_count                 &= nbsp;            |    106 |   =   1700 | t        | t
 doc_archive_img_count_exclude_no_image   |    107 | &n= bsp;   1700 | t        | t
 processing_date_number             &nbs= p;     |    108 |     1043 | t     =    | t
 ocr_item_state                = ;           |    109 |     170= 0 | t        | t
 ocr_started_on                = ;           |    110 |     111= 4 | t        | t
 ocr_finished_on               &nbs= p;          |    111 |     111= 4 | t        | t
 ems_cutoff_time               &nbs= p;          |    112 |     111= 4 | t        | t
 watchlist_item_state              =       |    113 |     1700 | t   &n= bsp;    | t
 rdc_number                 &n= bsp;             |    114 |   =     20 | t        | t
 rdc_created_on                = ;           |    115 |     111= 4 | t        | t
 rdc_created_by                = ;           |    116 |     &nb= sp; 20 | t        | t
 holdover_period               &nbs= p;          |    117 |     170= 0 | t        | t
 holdover_count                = ;           |    118 |     170= 0 | t        | t
 custom_userfield_234              =       |    119 |     1700 | t   &n= bsp;    | t
 custom_userfield_235              =       |    120 |     1700 | t   &n= bsp;    | t
 custom_userfield_236              =       |    121 |     1700 | t   &n= bsp;    | t
 custom_userfield_237              =       |    122 |     1700 | t   &n= bsp;    | t
 custom_userfield_238              =       |    123 |     1700 | t   &n= bsp;    | t
 custom_userfield_239              =       |    124 |     1700 | t   &n= bsp;    | t
 custom_userfield_240              =       |    125 |     1043 | t   &n= bsp;    | t
 custom_userfield_241              =       |    126 |     1043 | t   &n= bsp;    | t
 created_on                 &n= bsp;             |    127 |   =   1114 | t        | t
 created_by                 &n= bsp;             |    128 |   =     20 | t        | t
 modified_on                 &= nbsp;            |    129 |   =   1114 | t        | t
 modified_by                 &= nbsp;            |    130 |   =     20 | t        | t
 process_date                 =             |    131 |    = ; 1082 | t        | t
 partition_type                = ;           |    132 |     170= 0 | t        | t
(132 rows)



There are 132 columns in the foreign table and the local copy, all col= umn names match, data types match, and the remote table does not have any g= enerated columns.

I'm certainly overlooking something but don't see it.

Thanks

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
--_000_LV9PR02MB11231E84BBAF4D4357A94D86CE5062LV9PR02MB11231na_--