public inbox for [email protected]
help / color / mirror / Atom feedERROR Inserting into partition
4+ messages / 2 participants
[nested] [flat]
* ERROR Inserting into partition
@ 2024-10-22 14:36 Sbob <[email protected]>
0 siblings, 2 replies; 4+ messages in thread
From: Sbob @ 2024-10-22 14:36 UTC (permalink / raw)
To: [email protected] <[email protected]>
All;
I have created a table that looks like this:
CREATE TABLE myschema.cust_part (
cust_int_id bigint,
cust_ext_id bigint,
cust_tax_id varchar(20),
cust_dob date,
cust_dob_str varchar(20),
cust_last_name varchar(100),
cust_first_name varchar(100),
cust_middle_name varchar(100),
cust_addr1 text,
cust_city text,
cust_state text,
cust_zip varchar(5)
) PARTITION BY LIST (cust_last_name);
and a partition that looks like this:
CREATE TABLE part_schema.cust_info_5
PARTITION OF myschema.cust_part
FOR VALUES IN ('NELL');
if I insert ONLY the partition key column via a select from another
table it fails:
INSERT INTO part_schema.cust_info_5
( cust_last_name)
SELECT l_name from public.global_addr WHERE l_name = 'NELL';
ERROR: new row for relation "cust_info_5" violates partition constraint
DETAIL: Failing row containd (null, null, null, null, null, 'NELL',
null, null, null, null, null,null).
However if I insert the values directly it works:
INSERT INTO part_schema.cust_info_5 VALUES (null, null, null, null,
null, 'NELL', null, null, null, null, null,null)
;
INSERT 0 1
I'm stumped, this happens with other last name values as well such as
'N', and 'SMITH' thoughts?
I get the same behavior if I insert based on a select of all the
partition table columns
Thanks in advance
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR Inserting into partition
@ 2024-10-22 14:47 David G. Johnston <[email protected]>
parent: Sbob <[email protected]>
1 sibling, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2024-10-22 14:47 UTC (permalink / raw)
To: Sbob <[email protected]>; +Cc: [email protected] <[email protected]>
>
>
> INSERT INTO part_schema.cust_info_5
> ( cust_last_name)
> SELECT l_name from public.global_addr WHERE l_name = 'NELL';
> ERROR: new row for relation "cust_info_5" violates partition constraint
> DETAIL: Failing row containd (null, null, null, null, null, 'NELL',
> null, null, null, null, null,null).
>
>
Your to: address for this email is so confusing...and this really isn't
either a performance issue (meaning speed, not failure to perform at all)
or admin issue (general advice for running the server). It seems like a
bug report, though one missing the most critical piece of information, the
version.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR Inserting into partition
@ 2024-10-22 14:53 David G. Johnston <[email protected]>
parent: Sbob <[email protected]>
1 sibling, 1 reply; 4+ messages in thread
From: David G. Johnston @ 2024-10-22 14:53 UTC (permalink / raw)
To: Sbob <[email protected]>; +Cc: [email protected] <[email protected]>
On Tue, Oct 22, 2024 at 7:36 AM Sbob <[email protected]> wrote:
>
> INSERT INTO part_schema.cust_info_5
> ( cust_last_name)
> SELECT l_name from public.global_addr WHERE l_name = 'NELL';
> ERROR: new row for relation "cust_info_5" violates partition constraint
> DETAIL: Failing row containd (null, null, null, null, null, 'NELL',
> null, null, null, null, null,null).
>
>
Also, I am unable to reproduce this in development:
CREATE TABLE cust_part (
cust_int_id bigint,
cust_ext_id bigint,
cust_tax_id varchar(20),
cust_dob date,
cust_dob_str varchar(20),
cust_last_name varchar(100),
cust_first_name varchar(100),
cust_middle_name varchar(100),
cust_addr1 text,
cust_city text,
cust_state text,
cust_zip varchar(5)
) PARTITION BY LIST (cust_last_name);
CREATE TABLE cust_info_5
PARTITION OF cust_part
FOR VALUES IN ('NELL');
create table global_addr (l_name text);
insert into global_addr values ('NELL');
INSERT INTO cust_info_5
( cust_last_name)
SELECT l_name from global_addr WHERE l_name = 'NELL';
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR Inserting into partition
@ 2024-10-22 17:05 Sbob <[email protected]>
parent: David G. Johnston <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Sbob @ 2024-10-22 17:05 UTC (permalink / raw)
To: David G. Johnston <[email protected]>; +Cc: [email protected] <[email protected]>
Thanks, it turns out it was subtle user error
On 10/22/24 8:53 AM, David G. Johnston wrote:
> On Tue, Oct 22, 2024 at 7:36 AM Sbob <[email protected]> wrote:
>
>
> INSERT INTO part_schema.cust_info_5
> ( cust_last_name)
> SELECT l_name from public.global_addr WHERE l_name = 'NELL';
> ERROR: new row for relation "cust_info_5" violates partition
> constraint
> DETAIL: Failing row containd (null, null, null, null, null, 'NELL',
> null, null, null, null, null,null).
>
>
> Also, I am unable to reproduce this in development:
>
> CREATE TABLE cust_part (
> cust_int_id bigint,
> cust_ext_id bigint,
> cust_tax_id varchar(20),
> cust_dob date,
> cust_dob_str varchar(20),
> cust_last_name varchar(100),
> cust_first_name varchar(100),
> cust_middle_name varchar(100),
> cust_addr1 text,
> cust_city text,
> cust_state text,
> cust_zip varchar(5)
> ) PARTITION BY LIST (cust_last_name);
>
> CREATE TABLE cust_info_5
> PARTITION OF cust_part
> FOR VALUES IN ('NELL');
>
> create table global_addr (l_name text);
>
> insert into global_addr values ('NELL');
>
> INSERT INTO cust_info_5
> ( cust_last_name)
> SELECT l_name from global_addr WHERE l_name = 'NELL';
>
> David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-10-22 17:05 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22 14:36 ERROR Inserting into partition Sbob <[email protected]>
2024-10-22 14:47 ` David G. Johnston <[email protected]>
2024-10-22 14:53 ` David G. Johnston <[email protected]>
2024-10-22 17:05 ` Sbob <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox