On 16th of September 2019, Alexander Korotkov committed two patches:
Support for SSSSS datetime format pattern
SQL Standard 2016 defines SSSSS format pattern for seconds past midnight in
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause. In our
datetime parsing engine we currently support it with SSSS name.
This commit adds SSSSS as an alias for SSSS. Alias is added in favor of
upcoming jsonpath .datetime() method. But it's also supported in to_date()/
to_timestamp() as positive side effect.
Author: Nikita Glukhov, Alexander Korotkov
and second one:
Support for FF1-FF6 datetime format patterns
SQL Standard 2016 defines FF1-FF9 format patters for fractions of seconds in
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause. Parsing
engine of upcoming .datetime() method will be shared with to_date()/
This patch implements FF1-FF6 format patterns for upcoming jsonpath .datetime()
method. to_date()/to_timestamp() functions will also get support of this
format patterns as positive side effect. FF7-FF9 are not supported due to
lack of precision in our internal timestamp representation.
Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.
Heavily revised by me.
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov
Continue reading Waiting for PostgreSQL 13 – Support for FF1-FF6 and SSSS datetime format patterns
On 25th of October 2018, Michael Paquier committed patch:
Add pg_promote function
This function is able to promote a standby with this new SQL-callable
function. Execution access can be granted to non-superusers so that
failover tools can observe the principle of least privilege.
Catalog version is bumped.
Author: Laurenz Albe
Continue reading Waiting for PostgreSQL 12 – Add pg_promote function
Some time ago I wrote a site to paste SQL queries with reformatting/pretty-printing using pgFormatter library.
Today, I figured out that I should update the library since it has quite some changes recently, so it would be good to incorporate its fixes to paste site.
Unfortunately – new version is not backward compatible, and I currently have no time to figure out what has changed and how to work around it.
So – until I will have time to work on it, paste.depesz.com is no longer working. Sorry.
Some time ago I was looking (warning: post in polish) for someone to teach me proper parsing.
One of really great polish Perl programmers – Dozzie – reached out, and helped me. By the way – thanks a lot, Dozzie.
Based on what he taught me, I started writing module for parsing SQL queries. By that I mean proper parsing, with grammar (using Parse::Eyapp), and not set of regular expressions.
My parser is not ready. To say it lightly. Very lightly.
For now, it just knows how to parse the simplest queries like:
- select 1;
- select ‘a' as b;
I am working very slowly on it, so don't expect any usable version in any defined future. I will get there, eventually, but it is a project that I work on in my free time, after I finish everything else that I could work on in given moment.
This post is intended to announce that I'm working on it (so I will have kind of obligation to do it). And, if anyone is interested – I more than welcome all contributors/reviewers, and perhaps even critics 🙂
Final note – if you'll review the code, and want to comment on ugly list of regexps in Lexer – I know. It will be eventually replaced by one regular expression, but since it will be regular expression built by Regexp::Optimizer – it will not really be readable (though it will be faster than current approach).
On 5th of February, Tom Lane committed patch:
Allow SQL-language functions to reference parameters by name.
Matthew Draper, reviewed by Hitoshi Harada
Continue reading Waiting for 9.2 – Named parameters in SQL functions
Today some guy on IRC asked question, which I didn't fully understand, but which could (probably) be summarized: how to group data into 5 minute intervals, based on some timestamp column.
Well, it seems trivial (as long as you know how to do it), but since he clearly didn't know how to do it (or I misunderstood his problem), here's the explanation:
Continue reading Grouping data into time ranges
On 25th Robert Haas committed patch which adds first of ‘CREATE IF NOT EXISTS' commands:
CREATE TABLE IF NOT EXISTS.
Reviewed by Bernd Helmle.
Continue reading Waiting for 9.1 – CREATE TABLE IF NOT EXISTS
On 22nd of September, Tom Lane committed a patch by Petr Jelinek:
Implement the DO statement to support execution of PL code without having
to create a function for it.
Procedural languages now have an additional entry point, namely a function
to execute an inline code block. This seemed a better design than trying
to hide the transient-ness of the code from the PL. As of this patch, only
plpgsql has an inline handler, but probably people will soon write handlers
for the other standard PLs.
In passing, remove the long-dead LANCOMPILER option of CREATE LANGUAGE.
Continue reading Waiting for 8.5 – DO
This post has been updated with new code that uses temporary table – the code is at the end of post!
There was this question on Stack Overflow.
For future reference: guy asked how to do session variables – i.e. something he could define once in session, and later reuse in standard sql queries – without modifying postgresql.conf – so usage of custom_variable_classes is forbidden 🙂
While I don't actually see why somebody would want to avoid modifying its postgresql.conf (short of “it's shared hosting and I don't have superuser privileges"), I thought that it will be rather simple, and at the same time, rather interesting.
So, let's do it:
Continue reading Getting session variables without touching postgresql.conf
On 205h of July Andrew Dunstan committed patch by Andres Freund :
DROP IF EXISTS for columns and constraints. Andres Freund.
Continue reading Waiting for 8.5 – pgsql: DROP IF EXISTS for columns and constraints.