Re: Bug in SQL/MED?

Shigeru Hanada <shigeru.hanada@gmail.com>

From: Shigeru Hanada <shigeru.hanada@gmail.com>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: 花田 茂 <hanada@metrosystems.co.jp>, Albe Laurenz <laurenz.albe@wien.gv.at>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-01T09:52:16Z
Lists: pgsql-hackers

Attachments

2011/6/30 Alvaro Herrera <alvherre@commandprompt.com>:
> Excerpts from 花田 茂's message of jue jun 30 06:00:23 -0400 2011:
>
>> I attached a patch which fixes file_fdw to check required option
>> (filename) in its validator function.  I think that such requirement
>> should be checked again in PlanForeignScan(), as it had been so far.
>> Note that this patch requires fdw.patch has been applied.
>
> I think it'd be good to keep the error check in fileGetOptions() just to
> ensure that we don't crash in case a catalog is messed up with, though
> I'd degrade it to elog(ERROR) from ereport.

Thanks for the comments.  Please find attached a patch.  Now file_fdw
validates filename in:

* file_fdw_validator(), to catch lack of required option at DDL
* fileGetOptions(), to avoid crash caused by corrupted catalog

I used ereport for the former check, because maybe such error usually
happens and is visible to users.  This criteria was taken from the
document "Reporting Errors Within the Server".
http://developer.postgresql.org/pgdocs/postgres/error-message-reporting.html

Regards,
-- 
Shigeru Hanada