Chapter 19: pgrx-schema/src, forty lines

One file, and it is short enough to read in a minute. run takes its four arguments, reads the .so, finds the section whose name pgrx recognises as a schema section (is_schema_section_name), and refuses with "no pgrx schema section" if there is none. It parses the control file, decodes the entities (decode_entities), and builds the script with PgrxSql::build.

The one decision in it is borrowed from cargo-pgrx: a control file that names module_pathname, as this one does, gets MODULE_PATHNAME in the script, and one that does not gets a versioned library path.

Try it. Read main.rs top to bottom. Errors go to stderr as pgrx-schema: … with exit code 1, which is how buck shows a failed :ext build.

For the people who maintain it

FileWhat
main.rsThe whole tool.

← Previous: Chapter 18, pgrx-schema/ · Up: pgrx-schema · Next: Chapter 20, cargo-gen/ →