Difference between revisions of "Postgres Dev."

From Earlham CS Department
Jump to navigation Jump to search
(Test Environment)
(Postgres Internals Notes)
Line 1: Line 1:
 
== Postgres Internals Notes==
 
== Postgres Internals Notes==
 +
 +
=== Current Efforts ===
  
 
*Declaration of RelationGetRelationNamespace:
 
*Declaration of RelationGetRelationNamespace:
Line 6: Line 8:
 
postgresql-8.3.7/src/include/utils/rel.h
 
postgresql-8.3.7/src/include/utils/rel.h
 
</pre>
 
</pre>
** RelationGetNamespace
+
 
 +
RelationGetNamespace
 
 
*** There's a member variable: relnamespace in Form_pg_class data type.
+
There's a member variable: relnamespace in Form_pg_class data type.
It is of type id0, potentially representing a unique namespace identifier.
+
It is of type id0, potentially representing a unique namespace identifier. I just replaced the appearance of RelationGetRelationName(relation) with RelationGetNamespace(relation) and am waiting on the test enviroment to see whether this function returns the id number of the namespace (schema) in our simple example, this should refer to the ''public'' namespace.
 
 
*** What are it's member functions, and can we extract a char[] from thistype representing the name of the namespace?
 
  
*What's the difference between a tablespace and a namespace?
 
  
 
*Error "violates foreign key constraint:
 
*Error "violates foreign key constraint:
Line 19: Line 19:
 
postgresql-8.3.7/src/backend/utils/adt/ri_triggers.c:
 
postgresql-8.3.7/src/backend/utils/adt/ri_triggers.c:
 
</pre>
 
</pre>
 
  
 
== Test Environment ==
 
== Test Environment ==

Revision as of 20:30, 13 April 2009

Postgres Internals Notes

Current Efforts

  • Declaration of RelationGetRelationNamespace:
postgresql-8.3.7/src/include/utils/rel.h

RelationGetNamespace

There's a member variable: relnamespace in Form_pg_class data type. It is of type id0, potentially representing a unique namespace identifier. I just replaced the appearance of RelationGetRelationName(relation) with RelationGetNamespace(relation) and am waiting on the test enviroment to see whether this function returns the id number of the namespace (schema) in our simple example, this should refer to the public namespace.


  • Error "violates foreign key constraint:
postgresql-8.3.7/src/backend/utils/adt/ri_triggers.c:

Test Environment

We are currently creating a test environment on db-devel.cs.earlham.edu where a query causes a foreign key constraint. I created a simpler case, with a single relation. When I query

SELECT * FROM (wrong relation name)

An error gets returned, and only the relation name is reported. Our fix plans to address this case, however searching for error messages containing "does not exist" yielded too many result to be useful.

I was able to locate the error messages generated by foreign key constraints. They come from one file, called ri_triggers.c

I am currently creating a test enviroment where we can reproduce this error, and hopefully change the contents of the error message.

Open Questions