Re: SCHEMA compatibility with Oracle/DB2/Firebird

Lists: pgsql-general
From: Chris <pglist(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-22 19:25:39
Message-ID: 9a0c82c6050122112549b1a024@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I know this isn't entirely postgresql specific, but it wouldn't be on
another list either so here goes...

I am writing an open source application where I would like to support
at least oracle, and possibly firebird or DB2, in addition to
postgresql which will be the default. I'm not going to try to support
mysql.

The application has many users, and in postgresql what works well is
to create a schema for each user instead of a separate database. The
main reason for schema's instead of databases is that the app runs
under mod perl, and there are too many users to have a pool of open
connections to each database.

There are also a set of common functions that I usually store in the
public schema. That way when working with the data of a particular
user I can do a SET search_path TO user,public, and have access to all
the functions without having to duplicate them in every schema.

My question is how easily would this work with other databases? I
know Oracle supports schema's, but I dont' know about the others. I
also don't know if other databases have the concept of a search path,
but I would think that they do.

Chris


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris <pglist(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-22 21:29:43
Message-ID: 25477.1106429383@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Chris <pglist(at)gmail(dot)com> writes:
> ... My question is how easily would this work with other databases? I
> know Oracle supports schema's, but I dont' know about the others. I
> also don't know if other databases have the concept of a search path,
> but I would think that they do.

AFAIK the idea of a schema search path is specific to PG. I'm not sure
how you will handle your "public" functions in other DBMSes.

regards, tom lane


From: Chris <pglist(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-22 22:05:55
Message-ID: 9a0c82c605012214054a5ff490@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

>
> AFAIK the idea of a schema search path is specific to PG. I'm not sure
> how you will handle your "public" functions in other DBMSes.
>
> regards, tom lane
>

I'll probably have to go research this for each database. I have no
plans on immediately supporting other databases, but I don't want to
use a structure that will be extremely difficult to port down the
road.

Chris


From: Ian Barwick <barwick(at)gmail(dot)com>
To: Chris <pglist(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-23 03:25:26
Message-ID: 1d581afe05012219253ddd2c38@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sat, 22 Jan 2005 11:25:39 -0800, Chris <pglist(at)gmail(dot)com> wrote:
> I know this isn't entirely postgresql specific, but it wouldn't be on
> another list either so here goes...
>
> I am writing an open source application where I would like to support
> at least oracle, and possibly firebird or DB2, in addition to
> postgresql which will be the default. I'm not going to try to support
> mysql.

FWIW, Firebird doesn't have any form of schemas or cross-database
query support (although I think commercial third-party extensions might exist
for the latter).

You'll probably be best off explicitly providing schema names for your common
functions, e.g. SELECT * FROM common.mytable . Depending on your app,
that could be better from a security point of view in PostgreSQL as well,
if you want to prevent your users from sneakily replacing the common
database objects.

Ian Barwick


From: Chris <pglist(at)gmail(dot)com>
To: Ian Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-23 08:04:11
Message-ID: 9a0c82c60501230004c82fe1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

> You'll probably be best off explicitly providing schema names for your common
> functions, e.g. SELECT * FROM common.mytable . Depending on your app,
> that could be better from a security point of view in PostgreSQL as well,
> if you want to prevent your users from sneakily replacing the common
> database objects.
>
> Ian Barwick
>

In our case the schema's and users are a way to separate data as much
as possible. There aren't any physical users who can do their own
queries. Still a good idea though, that much less of a chance for bad
things to happen in case of a bug in the code.

Chris


From: Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org>
To: Chris <pglist(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-23 18:09:26
Message-ID: 41F3E856.7030107@visualdistortion.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Chris wrote:

>I know this isn't entirely postgresql specific, but it wouldn't be on
>another list either so here goes...
>
>I am writing an open source application where I would like to support
>at least oracle, and possibly firebird or DB2, in addition to
>postgresql which will be the default. I'm not going to try to support
>mysql.
>
>The application has many users, and in postgresql what works well is
>to create a schema for each user instead of a separate database. The
>main reason for schema's instead of databases is that the app runs
>under mod perl, and there are too many users to have a pool of open
>connections to each database.
>
>There are also a set of common functions that I usually store in the
>public schema. That way when working with the data of a particular
>user I can do a SET search_path TO user,public, and have access to all
>the functions without having to duplicate them in every schema.
>
>My question is how easily would this work with other databases? I
>know Oracle supports schema's, but I dont' know about the others. I
>also don't know if other databases have the concept of a search path,
>but I would think that they do.
>
>
>
Although Oracle doesn't have a search path, it is possible to make
functions publicly available by doing "grant blah to public". After
that they can be used without a schema identifier.

Jeff


From: Nicolai Tufar <ntufar(at)gmail(dot)com>
To: Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org>
Cc: Chris <pglist(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: SCHEMA compatibility with Oracle/DB2/Firebird
Date: 2005-01-25 09:29:45
Message-ID: d809293905012501291a361f4d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sun, 23 Jan 2005 12:09:26 -0600, Jeffrey Melloy
<jmelloy(at)visualdistortion(dot)org> wrote:
> Although Oracle doesn't have a search path, it is possible to make
> functions publicly available by doing "grant blah to public". After
> that they can be used without a schema identifier.

There is also
CREATE PUBLIC SINONYM thing in Oracle.

> Jeff
Nicolai