On 10/6/16, Simon Riggs <si...@2ndquadrant.com> wrote: > On 6 October 2016 at 04:43, Serge Rielau <se...@rielau.com> wrote: >>>> Or should I compose some sort of a design document? > > Having read this thread, I'm a little unclear as to what you're > writing now, though there's definitely good ideas here. > > I think it would be beneficial to write up a single coherent > description of this, including behaviour and a small sketch of > implementation, just so everyone knows what this is. No design doc, > but a summary.
At the moment I think it can also be a good idea to post the current patch as a Proposal or a WIP to get initial feedback. > It would be very useful to be able to do this... > ALTER TABLE foo ADD last_updated_timestamp timestamp default > current_timestamp > so that it generates a constant value and stores that for all prior > rows, but then generates a new value for future rows. Yes, it works for stable "now()" but does not work for volatile functions like "random()", "uuid_generate_v4()" or default for serial columns. The only possible way I can see is to check an expression has only "T_Const"s, static and stable functions. In such case the expression can be evaluated and the result be saved as a value for absented attributes of a tuple. In the other case save NULL there and rewrite the table. > Which makes me think we should call this missing_value or absent_value > so its clear that it is not a "default" it is the value we use for > rows that do not have any value stored for them. It is definitely a default for a user, it is not a regular default internally. I'm not a native speaker, "absent_value" can be mixed up with a NULL. As for me the best phrase is "pre-add-column-default", but it is impossible to use it as a column name. :-( It is still an open question. (I remember funny versions in a discussion when people tried to choose a name for a function reversed to pg_size_pretty...)  https://www.postgresql.org/message-id/flat/cafj8prd-tgodknxdygecza4on01_urqprwf-8ldkse-6bdh...@mail.gmail.com -- Best regards, Vitaly Burovoy -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers