X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B41328B9E89 for ; Thu, 3 Feb 2005 19:49:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81362-05 for ; Thu, 3 Feb 2005 19:48:54 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.202]) by svr1.postgresql.org (Postfix) with ESMTP id 20DAC8B9F1A for ; Thu, 3 Feb 2005 19:48:54 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id z35so301739rne for ; Thu, 03 Feb 2005 11:48:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=sbjKpa16Shs2wW4N5NyrXBLlasFEAPT6RocF37i2H+OllyQaAQXmSKgxbZmh1y0vNPdSGg76TwDMU0ywNJf5xktBYIEA/d1iS6SZ1ew2hlDWIQ+PcU9VAvz69wETVna8y6FGSRYMs8TuVFSbMnPfdFOMe7lCL4Mvu5dbtgEJjMs= Received: by 10.38.83.67 with SMTP id g67mr40686rnb; Thu, 03 Feb 2005 11:48:53 -0800 (PST) Received: by 10.39.3.14 with HTTP; Thu, 3 Feb 2005 11:48:53 -0800 (PST) Message-ID: Date: Thu, 3 Feb 2005 15:48:53 -0400 From: Philip Patterson Reply-To: Philip Patterson To: "Gerald.Laurent@bull.net" , pgsql-sql@postgresql.org Subject: Re: Information about the command SQL " create synonym". In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/74 X-Sequence-Number: 20185 On Tue, 12 Oct 2004 15:04:14 +0200, Gerald.Laurent@bull.net wrote: > Hello ! > > I am trying to find some informations about the SQL command "create > synonym". > > The command "create synonym" does not exit in the Postgres database. > > I had tested with the latest version (postgres8.0 beta3) and this command > is not present. > > I supposed that this command "create synnonym" is an extention of the SQL92 > on the other database like Oracle, Informix etc.. > > Could you say if this command will be implemanted in a future version of a > postgres database ? > > Best regards. > > Hi Gerald. Much like yourself, I have been searching for a way to create synonyms in Postgres. I think that I have found a hack / solution to our problem. Please bare in mind that I have not had an opportunity to fully test this from every angle, but the basics of SELECT, INSERT, UPDATE, and DELETE all work just fine. What I did, was to make use of the Postgres inheritance feature. The documentation's example uses this to create a new table that adds a new column/field to an existing table. However it seems quite happy to let you inherit without changing the structure of the original table at all. This in turn effectively creates an alias. For example, if you create a table as follows ... CREATE TABLE foo (bar int not null); but you need a synonym called "gerald", then you could do the following ... CREATE TABLE gerald () INHERITS (foo); You can now use the object "gerald" to do everything (that I tried) you want with "foo". I would love to hear from the developers, or other gurus, if there are any serious issues with doing this. Will it create any serious performance problems, or will there be functionality gaps between a real table and an inherited table that might limit the usefulness of this workaround? Best of luck, Philip