[SQL] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Achilleus Mantzios
Hi, i have run into the following problem. Let me describe the context first. When i joined the company(ies) i work for (a group of Shipping Mgmt/ Owenship/Agent companies), the only thing i was told when i started designing the DB/Apps was just one company. So i built everything into one single

Re: [SQL] [JDBC] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Markus Schaber
Hi, Achilleus, Achilleus Mantzios wrote: > Now i am thinking of restructuring the whole architecture as: > - Create one EAR app for every mgmt company > - Create one DB USER for every mgmg company > - Create one SCHEMA (same as the USER) for every mgmt company > (mgmtcompany1,mgmtcompany2,etc...

Re: [SQL] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Luckys
how about having a company table, and company_code column across all relevant table, although you'll have to modify your application also, which would be an additional clause in the WHERE condition e.g where company_code = 'which company user has logged in'. The user has to specify while logging u

Re: [SQL] [JDBC] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Achilleus Mantzios
O Markus Schaber έγραψε στις Apr 18, 2006 : > Hi, Achilleus, > > Achilleus Mantzios wrote: > > > Now i am thinking of restructuring the whole architecture as: > > - Create one EAR app for every mgmt company > > - Create one DB USER for every mgmg company > > - Create one SCHEMA (same as the USER

Re: [SQL] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Achilleus Mantzios
O Luckys έγραψε στις Apr 18, 2006 : > how about having a company table, and company_code column across all > relevant table, although you'll have to modify your application also, which > would be an additional clause in the WHERE condition e.g where company_code > = 'which company user has logged

Re: [SQL] [JDBC] Thoughts on a Isolation/Security problem.

2006-04-18 Thread Markus Schaber
Hi, Achilleus, Achilleus Mantzios wrote: [schema trickery] > Why do you think its ugly after all? It is not ugly to split such things via schemas per se, but it is ugly to use this schema trick together with a bunch of views, rules and triggers to "upgrade" a legacy single-deployment application

[SQL] Migrating a Database to a new tablespace

2006-04-18 Thread Markus Schaber
Hello, What is the easiest way to migrate a complete database from one tablespace to another? ALTER DATABASE only allows to set the default tablespace, but not migrating the existing database. Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software

[SQL] Looking for some help with cascading updates...

2006-04-18 Thread Mark True
Here is the question:I have a situation where I need to create triggers to cascade an insert operation to many tables to maintain foreign key constraints.  So at a high levelINSERT INTO myTable (Name, Address, Zip) VALUES ('Mark', '3 Dingle St.', '01832') myTable has a relation to two other tables,

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Andreas Kretschmer
Mark True <[EMAIL PROTECTED]> schrieb: > > Here is the question: > > I have a situation where I need to create triggers to cascade an insert > operation to many tables to maintain foreign key constraints. > > So at a high level > > INSERT INTO myTable (Name, Address, Zip) VALUES ('Mark', '3 D

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Mark True
I guess I should have clarified.  I am having trouble figuring out how to construct the IF statement to see if that item exists in the foreign table something like:count=select count(*) from table;if count=0 { insert fkey into myOtherTable}On 4/18/06, Andreas Kretschmer <[EMAIL PROTECTED]> wrote: M

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Andreas Kretschmer
Mark True <[EMAIL PROTECTED]> schrieb: > I guess I should have clarified. I am having trouble figuring out how to > construct the IF statement to see if that item exists in the foreign table > something like: > > count=select count(*) from table; > > if count=0 { > insert fkey into myOtherTable

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Mark True
Next silly question, how do you get your database to like plpgsql...I do CREATE LANGUAGE 'plpgsql' and it says it is not defined?--MarkOn 4/18/06, Andreas Kretschmer <[EMAIL PROTECTED]> wrote: Mark True <[EMAIL PROTECTED]> schrieb:> I guess I should have clarified.  I am having trouble figuring ou

[SQL] create temp table in rule

2006-04-18 Thread Ron Peterson
Is it possible to create a temporary table within a rule? I get a syntax error near 'CREATE TEMPORARY TABLE' if I try to do the following: CREATE RULE id_insert_rule AS ON INSERT TO id_insert DO INSTEAD ( CREATE TEMPORARY TABLE id_temp ( LIKE id ) ON COMMIT DELETE ROWS; INSERT INTO i

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Andreas Kretschmer
Mark True <[EMAIL PROTECTED]> schrieb: > Next silly question, how do you get your database to like plpgsql... - createlang on the command line - create language plpgsql; (in psql) > > I do CREATE LANGUAGE 'plpgsql' and it says it is not defined? Strange... > > --Mark > > > On 4/18/06, AA

Re: [SQL] Looking for some help with cascading updates...

2006-04-18 Thread Tom Lane
"Mark True" <[EMAIL PROTECTED]> writes: > I do CREATE LANGUAGE 'plpgsql' and it says it is not defined? Should work (in 8.1 anyway). Could we see the *exact* command and error message? regards, tom lane ---(end of broadcast)---

Re: [SQL] create temp table in rule

2006-04-18 Thread Tom Lane
Ron Peterson <[EMAIL PROTECTED]> writes: > Is it possible to create a temporary table within a rule? No, sorry. From memory, rules only allow SELECT/INSERT/UPDATE/DELETE plus NOTIFY (and there are restrictions on the latter). regards, tom lane ---

[SQL] Complex Informix OUTER

2006-04-18 Thread gurkan
Hi all. I have a fairly complicated Informix OUTER needs to be converted to PostgreSQL and I cannot get around it. For me it is fairly complicated Problem is inv_contracts OUTERS from three different tables and two out of these three (invention, 'dbuser as con') needs to SELECT for data (invention