Skip site navigation (1) Skip section navigation (2)

Bug in SQL/MED?

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in SQL/MED?
Date: 2011-06-29 12:23:45
Message-ID: D960CB61B694CF459DCFB4B0128514C2069B8DA1@exadv11.host.magwien.gv.at (view raw or flat)
Thread:
Lists: pgsql-hackers
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 behaviour.

Example:
CREATE EXTENSION file_fdw;
CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler VALIDATOR
file_fdw_validator;
CREATE SERVER file FOREIGN DATA WRAPPER file;
CREATE FOREIGN TABLE flat (id integer) SERVER file OPTIONS (format
'csv');
SELECT * FROM flat;
ERROR:  filename is required for file_fdw foreign tables

Now file_fdw does not try to enforce the "filename" option, but it
would be nice to be able to do so.

The attached patch would change the behaviour so that the validator
function
is always called.

If that change meets with approval, should file_fdw be changed so that
it
requires "filename" at table creation time?

Yours,
Laurenz Albe

Attachment: fdw.patch
Description: application/octet-stream (1.6 KB)

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-06-29 12:24:31
Subject: Re: time-delayed standbys
Previous:From: Florian PflugDate: 2011-06-29 11:35:48
Subject: Re: Range Types, constructors, and the type system

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group