| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Using Expanded Objects other than Arrays from plpgsql |
| Date: | 2024-11-01 22:20:09 |
| Message-ID: | 1947217.1730499609@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com> writes:
> Here's two backtraces from gdb from this function:
> CREATE OR REPLACE FUNCTION test2(graph matrix)
> RETURNS bigint LANGUAGE plpgsql AS
> $$
> BEGIN
> perform set_element(graph, 1, 1, 1);
> RETURN nvals(graph);
> end;
> $$;
Well, you shouldn't be using PERFORM. Not only does it not do the
right thing, but it's not optimized for expanded objects at all:
they'll get flattened both on the way into the statement and on
the way out. Try it with
graph := set_element(graph, 1, 1, 1);
RETURN nvals(graph);
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2024-11-01 22:27:53 | Re: Using Expanded Objects other than Arrays from plpgsql |
| Previous Message | Adrian Klaver | 2024-11-01 20:57:19 | Re: Plans for partitioning of inheriting tables |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2024-11-01 22:27:00 | Re: Doc: typo in config.sgml |
| Previous Message | Jacob Champion | 2024-11-01 21:47:38 | Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible |