refresh materialized view: concurrently + with no data

Started by Zizhuan Liuabout 17 hours ago1 messageshackers
Jump to latest
#1Zizhuan Liu
44973863@qq.com

Hi, Hackers,
`
When executing the command below:
    refresh materialized view concurrently MY_MATVIEW_2 with no data;
PostgreSQL throws the following error:
    ERROR:  REFRESH options CONCURRENTLY and WITH NO DATA cannot be used together.
`
I noticed that this error is reported in the executor within RefreshMatViewByOid(), 
rather than being checked earlier during parsing in gram.y when building RefreshMatViewStmt. 
We can simply detect the conflict between n->concurrent and n->skipData at parse time.
`
I’m curious whether this is a deliberate convention for PostgreSQL utility commands: 
  allowing conflicting option combinations to pass the parser, and deferring validity checks until executor execution?
`
Any clarification is appreciated.
`
`
Thanks,
--
ZizhuanLiu (X-MAN) 
44973863@qq.com