Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-08-27 Thread Hitoshi Harada
2011/8/26 Albe Laurenz : > I wrote: >> I wrote a FDW for Oracle to a) learn some server coding >> and b) see how well the FDW API works for me. > > I have released the software on PgFoundry: > http://oracle-fdw.projects.postgresql.org/ > > Would it make sense to mention that in chapter 5.10 > of th

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-08-26 Thread Dave Page
On Fri, Aug 26, 2011 at 3:09 PM, Tom Lane wrote: > Andrew Dunstan writes: >> On 08/26/2011 07:27 AM, Albe Laurenz wrote: >>> http://oracle-fdw.projects.postgresql.org/ >>> >>> Would it make sense to mention that in chapter 5.10 >>> of the documentation? > >> I don't think so, any more than any ot

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-08-26 Thread Tom Lane
Andrew Dunstan writes: > On 08/26/2011 07:27 AM, Albe Laurenz wrote: >> http://oracle-fdw.projects.postgresql.org/ >> >> Would it make sense to mention that in chapter 5.10 >> of the documentation? > I don't think so, any more than any other external module should be > mentioned in the docs. Th

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-08-26 Thread Andrew Dunstan
On 08/26/2011 07:27 AM, Albe Laurenz wrote: I wrote: I wrote a FDW for Oracle to a) learn some server coding and b) see how well the FDW API works for me. I have released the software on PgFoundry: http://oracle-fdw.projects.postgresql.org/ Would it make sense to mention that in chapter 5.10

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-08-26 Thread Albe Laurenz
I wrote: > I wrote a FDW for Oracle to a) learn some server coding > and b) see how well the FDW API works for me. I have released the software on PgFoundry: http://oracle-fdw.projects.postgresql.org/ Would it make sense to mention that in chapter 5.10 of the documentation? Yours, Laurenz Albe

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-25 Thread Robert Haas
On Fri, Jul 22, 2011 at 8:09 AM, Albe Laurenz wrote: > Heikki Linnakangas wrote: >>> I guess I misunderstood the concept of user mapping. > >>> I guess it is time to read my SQL Standard, but some clarification >>> in the documentation sure wouldn't hurt. >> >> Agreed, there doesn't seem to be any

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-23 Thread Tom Lane
Andrew Dunstan writes: > In that case I think I'm in favor of the suggestion of an implied empty > user mapping for PUBLIC, as long as it can be overridden. But how would you do that (override it)? All you can do is create an explicit mapping, and then you still have a mapping that allows acces

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-23 Thread Tom Lane
"Albe Laurenz" writes: > I don't like to think of a user mapping as a means to restrict access > to the foreign data source, because in effect that is the same as > restricting access to the foreign table, which is the ACL's job. No, the standard is quite clear that those are distinct things. See

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-23 Thread Andrew Dunstan
On 07/23/2011 10:42 AM, Tom Lane wrote: Andrew Dunstan writes: What does the standard say? Well, there is not a statement in so many words that you have to have a relevant USER MAPPING to use a foreign table. But the spec does specify that an FDW's ConnectServer function takes a UserHandle

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-23 Thread Tom Lane
Andrew Dunstan writes: > What does the standard say? Well, there is not a statement in so many words that you have to have a relevant USER MAPPING to use a foreign table. But the spec does specify that an FDW's ConnectServer function takes a UserHandle as one input parameter and should throw an

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-23 Thread Andrew Dunstan
On 07/22/2011 11:34 AM, Robert Haas wrote: No, you can specify connection details at per-server and per-foreign-table level too. The FDW implementation is free to accept or reject options where-ever it wants. Well, if we are going to take that viewpoint, then not having a user mapping *shou

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Albe Laurenz
Robert Haas wrote: >On Fri, Jul 22, 2011 at 12:32 PM, Tom Lane wrote: >> Robert Haas writes: >>> On Fri, Jul 22, 2011 at 12:13 PM, Tom Lane wrote: Well, if you read it that way, then CREATE USER MAPPING with an empty option set is a no-op: the behavior of the FDW would be the same whet

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Robert Haas
On Fri, Jul 22, 2011 at 12:32 PM, Tom Lane wrote: > Robert Haas writes: >> On Fri, Jul 22, 2011 at 12:13 PM, Tom Lane wrote: >>> Well, if you read it that way, then CREATE USER MAPPING with an empty >>> option set is a no-op: the behavior of the FDW would be the same whether >>> you'd executed i

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Tom Lane
Robert Haas writes: > On Fri, Jul 22, 2011 at 12:13 PM, Tom Lane wrote: >> Well, if you read it that way, then CREATE USER MAPPING with an empty >> option set is a no-op: the behavior of the FDW would be the same whether >> you'd executed it or not.  Which doesn't seem to me to satisfy the >> pri

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Robert Haas
On Fri, Jul 22, 2011 at 12:13 PM, Tom Lane wrote: > Robert Haas writes: >> On Fri, Jul 22, 2011 at 12:02 PM, Tom Lane wrote: >>> In particular I find the following in SQL-MED:2008 4.14.1: >>> >>> NOTE 9 - Privileges granted on foreign tables are not privileges to use >>> the data constituting fo

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Tom Lane
Robert Haas writes: > On Fri, Jul 22, 2011 at 12:02 PM, Tom Lane wrote: >> In particular I find the following in SQL-MED:2008 4.14.1: >> >> NOTE 9 - Privileges granted on foreign tables are not privileges to use >> the data constituting foreign tables, but privileges to use the >> definitions of

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Robert Haas
On Fri, Jul 22, 2011 at 12:02 PM, Tom Lane wrote: > Robert Haas writes: >> On Fri, Jul 22, 2011 at 10:01 AM, Tom Lane wrote: >>> I am not, however, convinced that that's a legitimate reading of the SQL >>> spec.  Surely user mappings are meant to constrain which users can >>> connect to a given

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Tom Lane
Robert Haas writes: > On Fri, Jul 22, 2011 at 10:01 AM, Tom Lane wrote: >> I am not, however, convinced that that's a legitimate reading of the SQL >> spec.  Surely user mappings are meant to constrain which users can >> connect to a given foreign server. > Surely that's the job for the table's

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Robert Haas
On Fri, Jul 22, 2011 at 10:01 AM, Tom Lane wrote: > Heikki Linnakangas writes: >> On 22.07.2011 11:08, Albe Laurenz wrote: >>> Or is a user mapping intended to be the only source of >>> connection information? > >> No, you can specify connection details at per-server and >> per-foreign-table leve

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Tom Lane
Heikki Linnakangas writes: > On 22.07.2011 11:08, Albe Laurenz wrote: >> Or is a user mapping intended to be the only source of >> connection information? > No, you can specify connection details at per-server and > per-foreign-table level too. The FDW implementation is free to accept or > reje

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Albe Laurenz
Heikki Linnakangas wrote: >> I guess I misunderstood the concept of user mapping. >> I guess it is time to read my SQL Standard, but some clarification >> in the documentation sure wouldn't hurt. > > Agreed, there doesn't seem to be any documentation on user mappings, > aside from the reference pa

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Heikki Linnakangas
On 22.07.2011 11:08, Albe Laurenz wrote: Tom Lane wrote: 1) GetUserMapping throws an error if there is no user mapping for the user (or PUBLIC). I think that it would be much more useful if it would return NULL or something similar instead. We could make it do that, but under what

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-22 Thread Albe Laurenz
Tom Lane wrote: >> 1) GetUserMapping throws an error if there is no >>user mapping for the user (or PUBLIC). >>I think that it would be much more useful if >>it would return NULL or something similar instead. > We could make it do that, but under what circumstances would it be > useful

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-21 Thread Tom Lane
"Albe Laurenz" writes: > I wrote a FDW for Oracle to a) learn some server coding > and b) see how well the FDW API works for me. > I came up with three questions/experiences: > 1) GetUserMapping throws an error if there is no >user mapping for the user (or PUBLIC). >I think that it would

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-21 Thread Albe Laurenz
Heikki Linnakangas wrote: >> 2) If I decide to close remote database connections after >> use, I would like to do so where reasonable. >> I would like to keep the connection open between query >> planning and query execution and close it when the >> scan is done. >> The exceptio

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-20 Thread Shigeru Hanada
Hi Albe, (2011/07/21 0:00), Albe Laurenz wrote: > 1) GetUserMapping throws an error if there is no > user mapping for the user (or PUBLIC). > I think that it would be much more useful if > it would return NULL or something similar instead. > Otherwise one would have to check for ex

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-20 Thread David Fetter
On Wed, Jul 20, 2011 at 08:26:19PM +0300, Heikki Linnakangas wrote: > On 20.07.2011 18:00, Albe Laurenz wrote: > >2) If I decide to close remote database connections after > >use, I would like to do so where reasonable. > >I would like to keep the connection open between query > >planni

Re: [HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-20 Thread Heikki Linnakangas
On 20.07.2011 18:00, Albe Laurenz wrote: 2) If I decide to close remote database connections after use, I would like to do so where reasonable. I would like to keep the connection open between query planning and query execution and close it when the scan is done. The exception

[HACKERS] Questions and experiences writing a Foreign Data Wrapper

2011-07-20 Thread Albe Laurenz
I wrote a FDW for Oracle to a) learn some server coding and b) see how well the FDW API works for me. I came up with three questions/experiences: 1) GetUserMapping throws an error if there is no user mapping for the user (or PUBLIC). I think that it would be much more useful if it would