Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSovJ-0007Gc-8w for pgsql-general@arkaria.postgresql.org; Sat, 23 Dec 2017 18:53:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSovH-0000SC-DD for pgsql-general@arkaria.postgresql.org; Sat, 23 Dec 2017 18:53:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eSovG-0000S2-Le for pgsql-general@lists.postgresql.org; Sat, 23 Dec 2017 18:53:27 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eSov9-0000GW-0S for pgsql-general@postgresql.org; Sat, 23 Dec 2017 18:53:25 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D4B8C20B84 for ; Sat, 23 Dec 2017 13:53:15 -0500 (EST) Received: from web2 ([10.202.2.212]) by compute6.internal (MEProxy); Sat, 23 Dec 2017 13:53:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bittivirhe.fi; h=content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=pMB3Du9FioivhSX7XcxGB0WedaWlww7TRpTRhvxJeVE=; b=leBgSqFP U1qR5intf22c0MXTl3xpiEGJwlgv+yxXo9IZxKpbwZDpdjPjDVJtXPrbL9fwF5xD CkgF7Ggg1S4mL8hz4dCX1N7M+hBl5rCMqGxmiquJ/m99id2OzFN1R0ah0aVT1him 1Ijd00XhNY7NotRA0JoQvxN48zGiXa6WdNmxQEuaZX+HDKEi/LXZD/IO8ykHpPQ+ 7ARIU3WNYU3pBDge4z6cY1O6rf+/b3Sl9W5P2E8xgMgKZ/NZwFA0/UjkZDfHreek n0uS5yGCFB1z4s1UygTsdRBH7WdqT7oPLLP4JeN3KksbrE0uX2u3+9SR6Hmt8Y0Z c15fKjAy6ZGVbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=pMB3Du9FioivhSX7XcxGB0WedaWlw w7TRpTRhvxJeVE=; b=Yw8HPE9yVnSjMW8jO8LQJEUQscAYPHFB+9aCbi/SBZ4vI k6ITGJOlQcIBPoNGlTa13AmqCuSwsTTZU/Pi2a55N17oWszwojNfm/YSenZMTQgE 2n5oTGIt0mPQLwjQqxEryBAuZ6IAqseVBXO4PTPQQgmWV8fxSLhavlbJ8jSy2XPC ZRtS1/5edKha1sXtNHrpsaVWqz1huYtsvN2+Awh9241T2CbGpYXOz3NOJNToLdL+ mZ/hJvYtbXAv/wgzpa+igxeap/ZIEvmECzBAebX1lv2QzItqaAMWroqVqj3DDW80 T8OaDOYT56YwOeALFuTdo1VMMIJoL3A0WNBsY1a7w== X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id 98A7D62B9E; Sat, 23 Dec 2017 13:53:15 -0500 (EST) Message-Id: <1514055195.1570504.1214442624.3DB93FFD@webmail.messagingengine.com> From: =?utf-8?Q?Timo=20Myyr=C3=A4?= To: pgsql-general@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-bb99f02b Date: Sat, 23 Dec 2017 20:53:15 +0200 Subject: Migrating to postgresql from oracle List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I'm preparing migration of our asset management system database from Oracle 12c to PostgreSQL 10. I'm using ora2pg and a bit of sed to mangle the SQL ready for import to pg but I've hit first problem: ERROR: referenced relation "..." is not a table Our Oracle databases uses single 'admin' schema and dedicated schema for each customer. For example usergroup mappings are held in admin.usergroup table. Then admin schema has customer-specific view on this table admin.usergroup_customer1 view which limits the full view to just those of that customer. And then each customers own schema has synonym to that view like customer1.usergroup. The applications queries use the "usergroup" table to query the group mappings. Here's hopefully a bit more detailed description of the database structure: ADMIN SCHEMA: TABLES: usergroup unit user ... VIEWS: usergroup_customer1 unit_customer1 user_customer1 ... CUSTOMER1 SCHEMA: TABLES: resource ... SYNONYM: usergroup (refers to admin.usergroup_customer1) user (refers to admin.user_customer1) unit (refers to admin.unit_customer1) ... So it seems that postgresql doesn't support foreign keys in views like Oracle. Would you have any suggestions how the above Oracle structure would best be handled in PostgreSQL? I'm pretty new to PostgreSQL so I might overlook something if I try to solve this by myself. Timo