The work on SQL/PSM compiler started
There are a basic code for plpsm language implementation. It's downloadable from github. Now only basic statements are supported - see a test.sql file.
pavel=# create or replace function test12(a int) returns int as $$ begin declare b,c,d int default 0; set b = a + 1, c = b + 1, d = c + 1; return d; end; $$ language psm0; NOTICE: Datums: 4 variables Size: 16 instruction 0 CopyParam 0, 0, size:4, byval:BYVAL 1 ExecExpr "SELECT (0)::integer",{} 2 SaveTo 1, size:4, byval:BYVAL 3 ExecExpr "SELECT (0)::integer",{} 4 SaveTo 2, size:4, byval:BYVAL 5 ExecExpr "SELECT (0)::integer",{} 6 SaveTo 3, size:4, byval:BYVAL 7 ExecExpr "SELECT ($1 + 1)::integer",{23,23,23,23} 8 SaveTo 1, size:4, byval:BYVAL 9 ExecExpr "SELECT ($2 + 1)::integer",{23,23,23,23} 10 SaveTo 2, size:4, byval:BYVAL 11 ExecExpr "SELECT ($3 + 1)::integer",{23,23,23,23} 12 SaveTo 3, size:4, byval:BYVAL 13 ExecExpr "SELECT ($4)::integer",{23,23,23,23} 14 Return size:4, byval:BYVAL 15 Done. CREATE FUNCTION
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home