Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Tom Lane
I wrote: > Another possibility that just occurred to me is to call the validator > like this: > > if (OidIsValid(fdwvalidator)) > { > Datumvalarg = result; > > /* pass a null options list as an empty array */ > if (DatumGetPointer(valarg) == NULL) >

Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Tom Lane
Shigeru Hanada writes: > 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 Applied with small adjustments.

Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Tom Lane
I wrote: > I think it might be better to keep the convention that an empty options > list is represented by null, and to say that if a validator wants to be > called on such a list, it had better declare itself non-strict. At > least we ought to think about that before redefining the catalog > sem

Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Tom Lane
Robert Haas writes: > 2011/7/1 Shigeru Hanada : >> 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

Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Albe Laurenz
Robert Haas wrote: 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.

Re: [HACKERS] Bug in SQL/MED?

2011-07-05 Thread Robert Haas
2011/7/1 Shigeru Hanada : > 2011/6/30 Alvaro Herrera : >> 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 P

Re: [HACKERS] Bug in SQL/MED?

2011-07-01 Thread Shigeru Hanada
2011/6/30 Alvaro Herrera : > 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

Re: [HACKERS] Bug in SQL/MED?

2011-06-30 Thread Alvaro Herrera
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 re

Re: [HACKERS] Bug in SQL/MED?

2011-06-30 Thread 花田 茂
(2011/06/29 21:23), Albe Laurenz wrote: > If you invoke any of the SQL/MED CREATE or ALTER commands, > the validator function is only called if an option list was given. > > That means that you cannot enforce required options at object creation > time, because the validator function is not always

Re: [HACKERS] Bug in SQL/MED?

2011-06-30 Thread Albe Laurenz
I wrote: > If you invoke any of the SQL/MED CREATE or ALTER commands, > the validator function is only called if an option list was given. [...] > Example: [...] The example is misleading. Here a better one: CREATE SERVER myoradb FOREIGN DATA WRAPPER oracle_fdw OPTIONS (foo 'bar'); ERROR: inva

[HACKERS] Bug in SQL/MED?

2011-06-29 Thread Albe Laurenz
If you invoke any of the SQL/MED CREATE or ALTER commands, the validator function is only called if an option list was given. That means that you cannot enforce required options at object creation time, because the validator function is not always called. I consider that unexpected an undesirable