RE: Object features of pg
От | Michael Ansley |
---|---|
Тема | RE: Object features of pg |
Дата | |
Msg-id | 7F124BC48D56D411812500D0B747251406144E@fileserver002.intecsystems.co.uk обсуждение исходный текст |
Ответ на | Object features of pg (Michael Ansley <Michael.Ansley@intec-telecom-systems.com>) |
Список | pgsql-sql |
<p><font size="2">Hi, Kenn,</font><p><font size="2">>> It seems that if you want to define a type address that </font><br/><font size="2">>> you will need more than a reference in another table. I </font><br /><font size="2">>> see what you're trying to do, but don't understand the </font><br /><font size="2">>> advantageof having a type address. Especially when you </font><br /><font size="2">>> seem to be using standard SQLto manipulate the data anyway.</font><br /><font size="2">I'm not sure how postgres does it, but I think that it mightactually store the address in the address table, and use an oid to reference it from the client table. The reason fordoing this is that a) it matches the way an object orientated language would map it, and b) it should be a LOT fasterthan using a foreign key lookup. My understanding is that using OIDs is way faster than using FKs, which is whereODBs get their speed from. So, if I can do objects like ODBs in postgres then I get the speed of an ODB with the funcionalityof a relational database (functions, sql, rules, etc.)</font><p><font size="2">Of course, I could just use theaddress OID as an FK on client, but that would only really be going half the distance.</font><p><font size="2">That'sthe plan, anyway.</font><p><font size="2">Cheers...</font><br /><br /><p><font size="2">>> </font><br/><font size="2">>> >>> Michael Ansley </font><br /><font size="2">>> <Michael.Ansley@intec-telecom-systems.com>10/03/00 09:25AM >>></font><br /><font size="2">>> No. I want the address attribute of the client class to </font><br /><font size="2">>> be of type address,</font><br/><font size="2">>> which is defined by the address table. Perhaps I should </font><br /><fontsize="2">>> have named things a</font><br /><font size="2">>> little more clearly ;-)</font><br /><fontsize="2">>> </font><br /><font size="2">>> </font><br /><font size="2">>> >> -----OriginalMessage-----</font><br /><font size="2">>> >> From: Kenn Thompson [<a href="mailto:KThompson@adestagroup.com">mailto:KThompson@adestagroup.com</a>]</font><br /><font size="2">>> >> Sent: 03 October 2000 15:15</font><br /><font size="2">>> >> To: Michael.Ansley@intec-telecom-systems.com</font><br /><font size="2">>> >> Subject: Re: [SQL] Object featuresof pg</font><br /><font size="2">>> >> </font><br /><font size="2">>> >> </font><br/><font size="2">>> >> Shouldn't that be </font><br /><font size="2">>> >> createtable address (address varchar(50), postcode </font><br /><font size="2">>> varchar(9));</font><br /><fontsize="2">>> >> create table client(id integer, name varchar(30), address </font><br /><font size="2">>> >> varchar(50);</font><br /><font size="2">>> >> ?</font><br /><font size="2">>> >> </font><br /><font size="2">>> >> >>> Michael Ansley </font><br /><fontsize="2">>> >> <Michael.Ansley@intec-telecom-systems.com> 10/03/00 </font><br /><font size="2">>> 08:14AM >>></font><br /><font size="2">>> >> I've done the following:</font><br/><font size="2">>> >> </font><br /><font size="2">>> >> create tableaddress (address varchar(50), postcode </font><br /><font size="2">>> varchar(9));</font><br /><font size="2">>> >> create table client(id integer, name varchar(30), </font><br /><font size="2">>> addressaddress);</font><br /><font size="2">>> >> </font><br /><font size="2">>> >> Now,how the hell do I get information into the address </font><br /><font size="2">>> >> field of client?</font><br/><font size="2">>> >> There appears to be very little in the manual dealing with </font><br/><font size="2">>> >> PGs object</font><br /><font size="2">>> >> features. Anypointers to places in the manual, or direct </font><br /><font size="2">>> >> instructions</font><br /><fontsize="2">>> >> would be gratefully accepted.</font><br /><font size="2">>> >> </font><br/><font size="2">>> >> Cheers...</font><br /><font size="2">>> >> </font><br /><fontsize="2">>> >> MikeA</font><br /><font size="2">>> >> </font><br /><font size="2">>> >> </font><br /><font size="2">>> </font>
В списке pgsql-sql по дате отправления: