Hello PostgreSQL hackers, I hope I am posting on the right mailing-list.
I am actually doing a PhD related to relational databases and software engineering. I use PostgreSQL for my research. I have a few questions about the internals of PostgreSQL and I think they require experts knowledge. I could not find documentation about that in the nice PostgreSQL documentation but maybe I missed something? Tell me if it is the case. My Questions: Q1. Are PostgreSQL's meta-description tables (such as pg_class) the "reality" concerning the state of the DB or are they just a virtual representation ? What I would like to know with this question is: would it be possible to implement DDL queries (e.g. CREATE TABLE, DROP TABLE, CREATE VIEW, ALTER TABLE, etc.) as DML queries that modify the meta-data stored in meta-description tables? For example, something like: INSERT INTO pg_class [...]; To create a new table (instead of the CREATE TABLE DDL query). Q1.1 If it is possible, is what is done in reality? I have the feeling that it is not the case and that DDL queries are implemented in C directly. Q1.2 If it is possible and not done, what is the reason? -- Q2. Are PostgreSQL's "meta-constraints" (i.e. constraints related to database structure such as "a table can only have a single primary key") implemented in C code or via data constraints on PostgreSQL's meta-description tables? I guess, again, they are implemented in C code, but I might be wrong. Q2.1 If they are not implemented via data constraints on meta-description tables, why ? Q2.2 Is there somewhere in the documentation a list of such "meta-constraints" implemented by PostgreSQL? Thanks in advance for answering my questions, any help or pointers to existing documentation will be appreciated. Cheers, Julien Delplanque