The project PSM (zero) is complete and needs you
Yesterday, Pavel Stehule finished work on the implementation of the procedural language SQL/PSM to PostgreSQL.
At the moment, the language supports all you need:
the
Some examples:
the
This language was not developed as a replacement for the native PL/pgSQL. It was developed as an alternative language with a slightly different philosophy:
the
The main advantage of the language is an early error to use nested SQL statements, usually at compile time. This feature is exceptional. PSM is a very static language. On the one hand, the more gestures you need to use dynamic SQL queries than they would use PL/pgSQL. On the other hand, a lot of runtime errors when using PL/pgSQL can be detected at compile time in the case of using PSM.
Task list:
the
Source code is available on github. Any help is welcome.
Article based on information from habrahabr.ru
At the moment, the language supports all you need:
the
-
the
- simple things, arrays, composite types (composites), triggers; the
- additional function that returns a table, IN/OUT parameters; the
- features SQL/PSM — warning, exception handlers (in most on the basis of SQLCODE), a SIGNAL or RESIGNAL statement;
some of the features of DB2 and MySQL — multi assign operators, support for magic SQLSTATE and SQLCODE variables.
Some examples:
the
create or replace function test74_2() returns text as $$ begin atomic declare not_found condition for sqlstate '03000'; declare undo handler for not_found begin declare xx, yy text; get stacked diagnostics xx = condition_identifier, yy = returned_sqlstate; return xx || 'Signal is handled' || yy; end; signal not_found; end; $$ language psm0; create or replace function test66(a int, r out int) as $$ begin declare continue handler for sqlstate '01002' set r = r + 1; declare continue handler for sqlstate '01003' set r = r + 2; set r = 0; x: while a > 0 do if a % 2 = 0 then signal sqlstate '01002'; else signal sqlstate '01003'; end if; set a = a - 1; end while; end; $$ language psm0;
This language was not developed as a replacement for the native PL/pgSQL. It was developed as an alternative language with a slightly different philosophy:
the
-
the
- full validation of the nested SQL at compile time; the
- early conversion of the results of the nested SQL in the target types (target types).
The main advantage of the language is an early error to use nested SQL statements, usually at compile time. This feature is exceptional. PSM is a very static language. On the one hand, the more gestures you need to use dynamic SQL queries than they would use PL/pgSQL. On the other hand, a lot of runtime errors when using PL/pgSQL can be detected at compile time in the case of using PSM.
Task list:
the
-
the
- to Complete the code review, add comments — any volunteers? the
- performance Optimizations. the
- Debugging of error messages.
Source code is available on github. Any help is welcome.
Комментарии
Отправить комментарий