Waiting for 8.5 – checking password strength

On 18th of November Tom Lane committed patch by Laurenz Albe which adds very interesting capability:

Add a hook to CREATE/ALTER ROLE to allow an external module to check the
strength of database passwords, and create a sample implementation of
such a hook as a new contrib module "passwordcheck".
 
Laurenz Albe, reviewed by Takahiro Itagaki

Continue reading Waiting for 8.5 – checking password strength

Waiting for 8.5 – PL/pgSQL variable resolution

On 13th of November (I know, backlog again), Tom Lane committed patch which make PostgreSQL more strict about what happens in stored procedures in PL/pgSQL:

Add control knobs for plpgsql's variable resolution behavior, and make the
default be "throw error on conflict", as per discussions.  The GUC variable
is plpgsql.variable_conflict, with values "error", "use_variable",
"use_column".  The behavior can also be specified per-function by inserting
one of
        #variable_conflict error
        #variable_conflict use_variable
        #variable_conflict use_column
at the start of the function body.
 
The 8.5 release notes will need to mention using "use_variable" to retain
backward-compatible behavior, although we should encourage people to migrate
to the much less mistake-prone "error" setting.
 
Update the plpgsql documentation to match this and other recent changes.

Continue reading Waiting for 8.5 – PL/pgSQL variable resolution

Waiting for 8.5 – TRIGGERS on columns

On 14th of October Tome Lane committed new patch from Itagaki Tahahiro:

Log Message:
-----------
Support SQL-compliant triggers on columns, ie fire only if certain columns
are named in the UPDATE's SET list.
 
Note: the schema of pg_trigger has not actually changed; we've just started
to use a column that was there all along.  catversion bumped anyway so that
this commit is included in the history of potentially interesting changes
to system catalog contents.
 
Itagaki Takahiro

Continue reading Waiting for 8.5 – TRIGGERS on columns

Waiting for 8.5 – Named function arguments

Pavel Stehule – hero for everybody writing stored procedures, wrote, and later Tom Lane committed patch which adds named arguments for functions:

Log Message:
-----------
Support use of function argument names to identify which actual arguments
match which function parameters.  The syntax uses AS, for example
funcname(value AS arg1, anothervalue AS arg2)
 
Pavel Stehule

Continue reading Waiting for 8.5 – Named function arguments

Waiting for 8.5 – GUC per user and database

On 7th of October Alvaro Herrera committed his own patch, which adds quite interesting possibilty:

Log Message:
-----------
Make it possibly to specify GUC params per user and per database.
 
Create a new catalog pg_db_role_setting where they are now stored, and better
encapsulate the code that deals with settings into its realm.  The old
datconfig and rolconfig columns are removed.
 
psql has gained a \drds command to display the settings.
 
Backwards compatibility warning: while the backwards-compatible system views
still have the config columns, they no longer completely represent the
configuration for a user or database.
 
Catalog version bumped.

Continue reading Waiting for 8.5 – GUC per user and database

Waiting for 8.5 – “GRANT ALL”

One of the most common (or perhaps even the most common) question people have regarding PostgreSQL, is how to change privileges for all tables.

Usually they want something like MySQL's:

GRANT ... ON database.* TO ...

Which is interesting as it is actually 2 distinct features in one:

  • grant privileges on all existing tables
  • automatically grant privileges on all tables that will be created in this database in the future

Now, thanks to 2 new patches – we have this possibility in PostgreSQL.

Continue reading Waiting for 8.5 – “GRANT ALL"

Waiting for 8.5 – ‘samehost’ and ‘samenet’ in pg_hba.conf

October, finally. “Only" 1 month of backlog in new features in 8.5, but I'm getting there 🙂

So, on 1st of October Tom Lane committed patch by Stef Walter:

Log Message:
-----------
Support "samehost" and "samenet" specifications in pg_hba.conf,
by enumerating the machine's IP interfaces to look for a match.
 
Stef Walter

For some reason I cannot find it in mailing list archive, but luckily have copy of email (without all headers unfortunately).

Continue reading Waiting for 8.5 – ‘samehost' and ‘samenet' in pg_hba.conf

Waiting for 8.5 – DO

On 22nd of September, Tom Lane committed a patch by Petr Jelinek:

Log Message:
-----------
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.
 
Petr Jelinek

Continue reading Waiting for 8.5 – DO

Czemu jestem taki ułomny? (wylgaryzmy, polish only)

Kurde. Mam w piwnicy żarówkę, ale zapala się ją jedynie kontaktem na dole. Czyli, jak wieczorem schodzę do piwnicy, to muszę zejść po ciemnych schodach i dopiero wtedy mogę zapalić światło.

Dodatkowo – dzieciaki się boją chodzić do piwnicy bo ciemno. Moja pani, marudziła kilka razy, że trzeba coś z tym zrobić. No więc zrobiłem. Pojechałem do sklepu, kupiłem kabel, przełączniki schodowe i zabrałem się za instalację. Skracając. Po 2 godzinach wyjebałem wszystko do śmieci. W ścianie mam dziury od gwoździ, dotychczasowy kontakt działa, ale już nie jest przypomocowany do ściany, ścianę mam upaćkaną jakimś chujstwem typu silikon a poziom wkurwienia przekroczył dopuszczalne normy.

Czemu, byle obszczumur spod bramu potrafi położyć kable i wbić gwoździki a ja, kurwa, nie?! Co bym nie zaczął co wymaga jakichkolwiek zdolności manualnych to muszę zrobić krzywdę sobie, komuś obok i wszystko rozwalić? To może i brzmi zabawnie, ale ja pierdolę, mam już dosyć samego faktu, że na położenie kabelka, co normalnie trwałoby 30 minut, ja tracę czas na szukanie kogoś, bo nawet jak już znajdę fachowca to mu się nie chce przychodzić do takiej małej roboty?

Dodatkowo – szukam kogoś kto mi naprawi przełącznik światła, doda drugi piętro wyżej i zniknie dziury po gwożdziach w ścianach. Aha. I zainstaluje lampkę w ogrodzie. Tego nawet nie chcę zaczynać.

Calculating backlog of events to handle

Yesterday on my favorite IRC channel fooqux asked interesting question. I took some more questions, and here is problem description:

We have a system which, every 5 minutes, takes a number of tasks to be done. Tasks are uniform. Within 5 minutes we can handle at most 100 tasks. Given the history of number of tasks added every 5 minutes, calculate backlog at any given moment.

Did you understand the problem? Well – I didn't. So, let's see the data, and expected output.

Continue reading Calculating backlog of events to handle