|Summary:||slonik command to update comments|
|Product:||Slony-I||Reporter:||Steve Singer <ssinger>|
|Component:||slonik||Assignee:||Slony Bugs List <slony1-bugs>|
Description Steve Singer 2010-12-21 13:20:26 UTC
Comment 1 Jeff Frost 2010-12-29 15:20:38 UTC
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.
Comment 2 Christopher Browne 2010-12-30 09:13:11 UTC
Comment 3 Christopher Browne 2010-12-30 09:25:46 UTC
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 substitution). Taking one step back, Slonik calls, for STORE NODE, storeNode(), which simply passes the work on to storeNode_int(), which again should "just work." 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 difficult. 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 exercised regularly. 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.