[odb-users] Postgres comment feature via ODB

Boris Kolpackov boris at codesynthesis.com
Mon Dec 11 10:58:37 EST 2017

Crispus Attucks <unusual.exception.thrown at gmail.com> writes:

> Hi, I have been skimming the documentation and have been trying to figure
> out whether there is a way to take advantage of the "comment" feature[1] in
> Postgres. Is this possible in odb?

If there were a way to specify comments as part of a column definition,
then you could have used the 'options' pragma. But it looks like they
can only be specified as separate statements.

> If this is not a feature and not a development priority,

Yes, its use seems rather limited so definitely not a priority.

> perhaps you could point me to where I could begin investigating how
> to intercept the --generate-schema output for postgres (as well as
> the easiest way to tack on some new pragmas.)  Moreover, some guidance
> on how to iterate over the fields and data types before the "create 
> table" sql is generated would be helpful.

The schema is first generated into the in-memory model described in
odb/semantics/relational/. This is done by the relational::model::generate()
function in odb/relational/model.cxx Then it is written as SQL by
relational::schema::generate_{drop,create}() in odb/relational/schema.cxx.
Pragmas are defined in odb/pragma.cxx.


More information about the odb-users mailing list