Hi Flavio,

that error message refers to Flink tables and Flink views, not Postgres
views: within the catalog, no Flink table or Flink view of that name
exists. Note that even Postgres views would have to be represented as Flink
tables in Flink.

In order to change the message to (Postgres) "views not being supported",
the catalog would have to make another check against the database to see if
a (Postgres) view for it exists, which seems a bit odd to do, IMO. Catalogs
can list the tables within them, so if you first list the tables you'd see
that your (Postgres) view is not contained in the catalog.

I don't think there's a reason why the catalog couldn't in theory support
representing Postgres views as Flink tables. The JDBC sink connector of
course cannot work for those, but the source connector could (I don't know
if it currently does; if not that'd be a good reason for the current
behavior of the catalog).
But yes, your assumption that the catalog doesn't support Postgres views
currently is correct, see [1].

[1]
https://github.com/apache/flink/blob/master/flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/PostgresCatalog.java#L168


Ingo

On Fri, Nov 26, 2021, 15:02 Flavio Pompermaier <[email protected]> wrote:

> Hi to all,
> I was trying to use a view of my Postgres database through the
> PostgresCatalog but at the moment it seems that the current implementation
> ignores views. Probably this is caused by the fact that there's no way to
> avoid INSERT statements in Flink.
> However, the thrown error is somehow misleading because the
> PostgresCatalog.getTable() throws a TableNotExistException whose errore
> message is
>
> private static final String MSG = "Table (or view) %s does not exist in
> Catalog %s.";
>
> Maybe the thrown exception could be more helpful and could report that
> views are not supported by this catalog implementation. What do you think?
>
> Best,
> Flavio
>

Reply via email to