postgres@guedes-laptop:/srv/postgresql/HEAD/bin$ /srv/postgresql/HEAD/bin/psql psql (8.4devel) Type "help" for help. postgres=# SELECT version(); version --------------------------------------------------------------------------------------------------- PostgreSQL 8.4devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) (1 row) postgres=# CREATE USER blog; CREATE ROLE postgres=# CREATE DATABASE blo postgres=# CREATE DATABASE blog OWNER postgres=# CREATE DATABASE blog OWNER blog; CREATE DATABASE postgres=# \c blog blog psql (8.4devel) You are now connected to database "blog" as user "blog". blog=> CREATE SCHEMA hr; CREATE SCHEMA blog=> CREATE TABLE hr.person( blog(> nro_doc numeric(10) primary key, blog(> name varchar(50) not null, blog(> nro_doc_parent numeric(10) references hr.person(nro_doc) blog(> ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "person_pkey" for table "person" CREATE TABLE blog=> SET search_path TO public,hr; SET blog=> \dt List of relations Schema | Name | Type | Owner --------+--------+-------+------- hr | person | table | blog (1 row) blog=> \d person Table "hr.person" Column | Type | Modifiers ----------------+-----------------------+----------- nro_doc | numeric(10,0) | not null name | character varying(50) | not null nro_doc_parent | numeric(10,0) | Indexes: "person_pkey" PRIMARY KEY, btree (nro_doc) Foreign-key constraints: "person_nro_doc_parent_fkey" FOREIGN KEY (nro_doc_parent) REFERENCES person(nro_doc) Referenced by: "person_nro_doc_parent_fkey" IN person FOREIGN KEY (nro_doc_parent) REFERENCES person(nro_doc) blog=> INSERT INTO hr.person VALUES blog-> (1234567890,'JOAO DA SILVA',NULL), blog-> (0987654321,'MARCO ANTONIO DE SOUZA',NULL), blog-> (0192837465,'MARIA ANTONIETA DA SILVA',1234567890), blog-> (0987612345,'LUIZ ANTONIO MARCOS',1234567890), blog-> (0912219083,'ALTAZIGIO FERREIRA MARCOS',0987612345); INSERT 0 5 blog=> WITH RECURSIVE parents(son_name,son_doc,parent_name,parent_doc) AS blog-> ( blog(> SELECT name, nro_doc, '' as parent_name, 0 as parent_doc FROM hr.person WHERE nro_doc_parent is null blog(> UNION ALL blog(> SELECT a.name as son_name, blog(> a.nro_doc as son_doc, blog(> b.parent_name, blog(> b.parent_doc blog(> FROM hr.person a INNER JOIN parents b ON a.nro_doc_parent = b.parent_doc blog(> ) blog-> SELECT * from filiacao order by 1,2; TRAP: FailedAssertion("!(((((Node*)(cte->ctequery))->type) == T_Query))", File: "parse_target.c", Line: 307) server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: LOG: server process (PID 7055) was terminated by signal 6: Aborted LOG: terminating any other active server processes FATAL: the database system is in recovery mode Failed. !> LOG: all server processes terminated; reinitializing LOG: database system was interrupted; last known up at 2008-10-05 17:28:57 BRT LOG: database system was not properly shut down; automatic recovery in progress LOG: record with zero length at 0/498380 LOG: redo is not required LOG: autovacuum launcher started LOG: database system is ready to accept connections !> \q postgres@guedes-laptop:/srv/postgresql/HEAD/bin$ /srv/postgresql/HEAD/bin/psql -U blog psql (8.4devel) Type "help" for help. blog=> WITH RECURSIVE parents(son_name,son_doc,parent_name,parent_doc) AS ( SELECT name, nro_doc, '' as parent_name, 0 as parent_doc FROM hr.person WHERE nro_doc_parent is null UNION ALL SELECT a.name as son_name, a.nro_doc as son_doc, b.parent_name, b.parent_doc FROM hr.person a INNER JOIN parents b ON a.nro_doc_parent = b.parent_doc ) SELECT * from filiacao order by 1,2; TRAP: FailedAssertion("!(((((Node*)(cte->ctequery))->type) == T_Query))", File: "parse_target.c", Line: 307) server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: LOG: server process (PID 7085) was terminated by signal 6: Aborted LOG: terminating any other active server processes FATAL: the database system is in recovery mode Failed. !> LOG: all server processes terminated; reinitializing LOG: database system was interrupted; last known up at 2008-10-05 17:30:04 BRT LOG: database system was not properly shut down; automatic recovery in progress LOG: record with zero length at 0/4983C4 LOG: redo is not required LOG: autovacuum launcher started LOG: database system is ready to accept connections !> \q