pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: wagner.engel@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16202: Cannot restore database that has materialized view using crosstab (tablefunc)
Date: Fri, 10 Jan 2020 13:04:05 -0500
Message-ID: <12604.1578679445@sss.pgh.pa.us> (raw)
In-Reply-To: <16202-b6b345c9d2819409@postgresql.org>
References: <16202-b6b345c9d2819409@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> If I build a materizalized view that uses the crosstab() function, a
> dump/restore cycle will not restore the database.

> CREATE VIEW v AS
> SELECT * FROM crosstab (
> 	'SELECT id FROM t as t1',
> 	'SELECT id FROM t as t2'
> ) ct (a integer, b integer);

This view is unsafe because it doesn't schema-qualify its reference
to table t.  It will fail if run with a restrictive search_path,
which is what pg_dump does for security reasons.

An ordinary view reference to "t" would be all right, because the
system understands what that is and can adjust the schema qualification;
but here you've just got a string that happens to contain "t" in it.

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <12604.1578679445@sss.pgh.pa.us>
Permalink:  ../12604.1578679445@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12604.1578679445@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wagner.engel@gmail.com
  Subject: Re: BUG #16202: Cannot restore database that has materialized view using crosstab (tablefunc)
  In-Reply-To: <12604.1578679445@sss.pgh.pa.us>
  References: <16202-b6b345c9d2819409@postgresql.org> <12604.1578679445@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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