pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18148: Handle null in a date/time fields when passing empty arrays issue
2+ messages / 2 participants
[nested] [flat]

* BUG #18148: Handle null in a date/time fields when passing empty arrays issue
@ 2023-10-05 14:44  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2023-10-05 14:44 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jaafarmelhem2591@gmail.com

The following bug has been logged on the website:

Bug reference:      18148
Logged by:          jaafar melhem
Email address:      jaafarmelhem2591@gmail.com
PostgreSQL version: 14.6
Operating system:   linux-gnu
Description:        

- I have 4 fields in a table, two are date type and two are time type, and i
have arrays to insert from them to this table.
- I have a function to insert to this table: IN "p_fromdates"
_varchar=NULL::character varying[], IN "p_todates" _varchar=NULL::character
varying[], IN "p_fromtimes" _varchar=NULL::character varying[], IN
"p_totimes" _varchar=NULL::character varying[],
- and I am inserting them like this : 
unnest(p_fromdates::_varchar)::date, unnest(p_todates::_varchar)::date,
unnest(p_fromtimes::_varchar)::time, 
unnest(p_totimes::_varchar)::time, 
- However when passing null values (empty arrays), the record is not
inserted, 
- I have tried to handle it but I didn't find any way, always the record is
not inserted if the 4 arrays are empty.
Postgresql version : PostgreSQL 14.6 on x86_64-pc-linux-gnu, compiled by gcc
(GCC) 8.5.0 20210514 (Red Hat 8.5.0-15), 64-bit



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18148: Handle null in a date/time fields when passing empty arrays issue
@ 2023-10-05 15:07  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2023-10-05 15:07 UTC (permalink / raw)
  To: jaafarmelhem2591@gmail.com; pgsql-bugs@lists.postgresql.org

On Thu, Oct 5, 2023 at 7:59 AM PG Bug reporting form <noreply@postgresql.org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference:      18148
> Logged by:          jaafar melhem
> Email address:      jaafarmelhem2591@gmail.com
> PostgreSQL version: 14.6
> Operating system:   linux-gnu
> Description:
>
> - I have 4 fields in a table, two are date type and two are time type, and
> i
> have arrays to insert from them to this table.
> - I have a function to insert to this table: IN "p_fromdates"
> _varchar=NULL::character varying[], IN "p_todates" _varchar=NULL::character
> varying[], IN "p_fromtimes" _varchar=NULL::character varying[], IN
> "p_totimes" _varchar=NULL::character varying[],
> - and I am inserting them like this :
> unnest(p_fromdates::_varchar)::date, unnest(p_todates::_varchar)::date,
> unnest(p_fromtimes::_varchar)::time,
> unnest(p_totimes::_varchar)::time,
> - However when passing null values (empty arrays), the record is not
> inserted,
> - I have tried to handle it but I didn't find any way, always the record is
> not inserted if the 4 arrays are empty.
> Postgresql version : PostgreSQL 14.6 on x86_64-pc-linux-gnu, compiled by
> gcc
> (GCC) 8.5.0 20210514 (Red Hat 8.5.0-15), 64-bit
>
>
This is not a bug, it is actually doing exactly what one would expect to
happen if you ask the system to "insert nothing into this table".

null and "empty array" are two very different things.

What is the system supposed to insert if you don't provide it any values?

It is better if you provide an actual executable SQL script when asking for
help.

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-10-05 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 14:44 BUG #18148: Handle null in a date/time fields when passing empty arrays issue PG Bug reporting form <noreply@postgresql.org>
2023-10-05 15:07 ` David G. Johnston <david.g.johnston@gmail.com>

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