Slonik allows you to specify a descriptive comment on sets, nodes and tables.
However we provide no way of changing that comment after it has been entered (short of manually executing UPDATE on sl_set on all nodes, which is discouraged)
We should add a command to update comments on objects or at least nodes and sets.
This feature request was passed to me from a DBA.
Looks like there is already some functionality for updating in the storenode_int(integer, text) and storeset_int(integer, integer, text) functions:
It's just not exposed in slonik.
So, you would think you can do something like this:
select _schemadoc.createEvent('_schemadoc', 'STORE_NODE', '1', 'Node 1 description');
select _schemadoc.createEvent('_schemadoc', 'STORE_SET', '1', '1', 'new set description');
but at least on 1.2, it causes the slons to crash.
The event STORE_NODE leads to calling the function storeNode_int(),
which seems to be suitably idempotent, where:
- If the node doesn't exist, it'll add it;
- If the node *does* exist, it updates the comment.
Similarly, STORE_SET leads to calling the function storeSet_int(),
which has the equivalent logic (with the appropriate s/node/set/g
Taking one step back, Slonik calls, for STORE NODE, storeNode(), which
simply passes the work on to storeNode_int(), which again should "just
Unfortunately, in slonik, slonik_store_node() assumes it's creating a
new node, so some rework would need to be done to allow it to cope
with this reconfiguration of the node.
On the SET side, slonik uses the command CREATE SET, which is pretty
clearly intended to create a new set. It should be straightforward to
create another command, STORE SET, which is only permitted to alter
the comment on the set. It's a bit of work, but shouldn't be
I'm not sure why it didn't work to inject the events by hand; in
reading the code (in HEAD), it seems as though that ought to work
already. Hopefully fixing it involves a little debugging, and adding
some examples to the regression tests to ensure the logic gets
The changes are straightforward enough that I'd encourage having someone that's new to altering Slonik work on it, so that we have more people that understand how to do so.