Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does PostgreSQL to be ORDBMS mean?

Query has not much helped.

As mentioned here, PostgreSQL is ORDBMS.

here, it explains PostgreSQL being RDBMS.


What does it mean that PostgreSQL is an ORDBMS? Is it about supporting user defined datatypes?

like image 982
overexchange Avatar asked Aug 24 '17 15:08

overexchange


People also ask

Is PostgreSQL an ORDBMS?

PostgreSQL is an object-relational database management system ( ORDBMS ) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. POSTGRES pioneered many concepts that only became available in some commercial database systems much later.

What is the meaning ORDBMS?

An object–relational database (ORD), or object–relational database management system (ORDBMS), is a database management system (DBMS) similar to a relational database, but with an object-oriented database model: objects, classes and inheritance are directly supported in database schemas and in the query language.

What is ORDBMS with example?

Since their hybrid systems that don't exactly match the ideals of an object-oriented DBMS, they are called object-relational database management systems (ORDBMSs). Examples of ORDBMSs include PostgreSQL and Oracle (and, to a lesser extent, Microsoft's SQL Server).

What is the difference between OODBMS and ORDBMS?

RDBMS uses tables to represent data and their relationships whereas OODBMS represents data in form of objects similar to Object Oriented Programming. Following are the important differences between RDBMS and OODBMS.


1 Answers

An ORDBMS is primarily a relational database that supports some object oriented features.

PostgreSQL or Postgres (not PostGres) supports table inheritance and function overloading. Both are features usually attributed to object oriented languages.

One of the situations where the object-oriented approach is visible is the fact that for each table there is a corresponding data type created. So a table is essentially a set of "instances" of a specific type.

You can even explicitly define a table like that:

create type person_type as (id integer, firstname text, lastname text);
create table person of person_type;

Type inheritance is only supported for table types, not for base types:

create table person (id integer, firstname text, lastname text);
create table person_with_dob
( 
   dob date
) inherits (person);

This is however not fully object oriented because the type definition lacks the ability to defined methods on the type (=class) including method visibility. The closest thing to a type method is a function with that type as the parameter:

create table person (id integer, firstname text, lastname text);

create function fullname(p_row person) returns text
as
$$
  select concat_ws(' ', p_row.firstname, p_row.lastname);
$$ 
language sql;

insert into person (id, firstname, lastname) values (42, 'Arthur', 'Dent');

Now you can run:

select p.fullname
from person p;

and it returns:

fullname   
-----------
Arthur Dent

even though there is no column named fullname in the table person. This behaviour is the closest to a real class/type method found in object oriented languages (but it's not the same thing as it still lacks the ability to define e.g. private methods)


Creating user defined structured data types is typically also seen as an object oriented feature:

create type address_type (city text, zipcode text, street text);

create table person
(
  id integer primary key,
  firstname text,
  lastname text, 
  billing_address address_type, 
  shipping_address address_type
);

Arrays can also be seen as "sets of objects" however this is not necessarily an object oriented feature.

like image 94
a_horse_with_no_name Avatar answered Nov 16 '22 03:11

a_horse_with_no_name