Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert

Поиск
Список
Период
Сортировка
От Jeevan Chalke
Тема Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert
Дата
Msg-id CAM2+6=V5Ytx-noS3=1wVR=T-H-98TOwaiaMJqEOppzoRf9YXww@mail.gmail.com
обсуждение исходный текст
Ответ на Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Ответы Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert  (Andres Freund <andres@2ndquadrant.com>)
Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
Hi Tom,

Since we are close to release, we should not have crashes like this.

Please have a look. My patch may not be correct as I haven't looked closely.

Thanks


On Mon, Apr 22, 2013 at 7:28 PM, Jeevan Chalke <jeevan.chalke@enterprisedb.com> wrote:



On Mon, Apr 22, 2013 at 6:41 PM, Andres Freund <andres@2ndquadrant.com> wrote:
On 2013-04-22 18:35:04 +0530, Jeevan Chalke wrote:
> Hi,
>
> I have observed that following sequence is causing server crash.
>
> CREATE MATERIALIZED VIEW temp_class_mv AS
>   SELECT * FROM pg_class
>   WITH NO DATA;
>
> CREATE OR REPLACE FUNCTION test_refresh_mv()
> RETURNS int
> AS $$
> BEGIN
>  REFRESH MATERIALIZED VIEW temp_class_mv;
>  return 1;
> END; $$ LANGUAGE plpgsql;
>
> SELECT test_refresh_mv();
>
>
> I had a quick look over the crash and it is hitting following Assert in
> spi.c:
>
>                 else if (IsA(stmt, RefreshMatViewStmt))
>                 {
>                     Assert(strncmp(completionTag,
>                                    "REFRESH MATERIALIZED VIEW ", 23) == 0);
>                     _SPI_current->processed = strtoul(completionTag + 23,
>                                                       NULL, 10);
>                 }
>
> It seems like we are missing expected value for completionTag in
> ExecRefreshMatView()

Possibly independent from this issue, but where did that 23 come from?

23 is also bogus here.
It should be 26 i.e. length of "REFRESH MATERIALIZED VIEW "

BTW, attached is the patch which works well for me, but need details review.

Thanks
 
ISTM we're strtoul()ing "EW somenumber" here.

Greetings,

Andres Freund

--
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



--
Jeevan B Chalke
Senior Software Engineer, R&D
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Phone: +91 20 30589500

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.



--
Jeevan B Chalke
Senior Software Engineer, R&D
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Phone: +91 20 30589500

Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Couple of issues with pg_xlogdump
Следующее
От: Andres Freund
Дата:
Сообщение: Re: REFRESH MATERIALIZED VIEW command in PL block hitting Assert