Postgresql9.6 type cache invalidation issue - different behave of psql and pg regress

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Postgresql9.6 type cache invalidation issue - different behave of psql and pg regress
Date: 2018-04-20 09:00:30
Message-ID: CAFj8pRDTsukmqJBda_cB1R1N1TUdxJPD4kohsHKK4hXAY=-2XQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I searching a reason why result of plpgsql_check's regress tests are
different when its executed from regress tests or interactive.

This is simple test

drop table testtable;

create table testtable(a int, b int);

create or replace function test()
returns int as $$
declare r testtable;
begin
select * into r from testtable;
return r.a;
end;
$$ language plpgsql;

alter table testtable drop column b;
select * from plpgsql_check_function('test()');

this test should to return 0 rows, and it is working when I run it as test.
But when I execute it in psql I got

┌───────────────────────────────────────────────────────────────────────┐
│ plpgsql_check_function │
╞═══════════════════════════════════════════════════════════════════════╡
│ warning:00000:4:SQL statement:too few attributes for target variables │
│ Detail: There are more target variables than output columns in query. │
│ Hint: Check target variables in SELECT INTO statement. │
└───────────────────────────────────────────────────────────────────────┘
(3 rows)

In interactive mode, the build_row_from_class has unrefreshed metadata. But
why this behave I see only in psql and not in my regress tests?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2018-04-20 09:02:45 Re: Built-in connection pooling
Previous Message Amit Langote 2018-04-20 08:51:27 Re: Should we add GUCs to allow partition pruning to be disabled?