Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Dimitri Fontaine
Pavel Stehule pavel.steh...@gmail.com writes: When I worked on parametrised DO statement, I had to solve following issue: DO currently is a utility command, not a query. Do you mean to change that? Also, did you think about a lambda construct, which is basically allowing functions to be defined

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Dimitri Fontaine dimi...@2ndquadrant.fr: Pavel Stehule pavel.steh...@gmail.com writes: When I worked on parametrised DO statement, I had to solve following issue: DO currently is a utility command, not a query. Do you mean to change that? Also, did you think about a lambda

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Dimitri Fontaine dimi...@2ndquadrant.fr writes: We could imagine several syntax to show up the idea, common keywords here include LAMBDA, FLET or LABELS, but I think that expanding WITH would be preferable for us. WITH FUNCTION foo(param list) returns rettype language foo AS (

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Tom Lane t...@sss.pgh.pa.us: Dimitri Fontaine dimi...@2ndquadrant.fr writes: We could imagine several syntax to show up the idea, common keywords here include LAMBDA, FLET or LABELS, but I think that expanding WITH would be preferable for us. WITH FUNCTION foo(param list) returns

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Dimitri Fontaine
Pavel Stehule pavel.steh...@gmail.com writes: WITH FUNCTION foo(param list) returns rettype language foo AS ( definition here ) query using foo() here; I like this idea. This gets rid of both the how to pass parameters and the how to return results issues that exist with DO, as

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Pavel Stehule
2012/7/10 Dimitri Fontaine dimi...@2ndquadrant.fr: Pavel Stehule pavel.steh...@gmail.com writes: WITH FUNCTION foo(param list) returns rettype language foo AS ( definition here ) query using foo() here; I like this idea. This gets rid of both the how to pass parameters and the

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: 2012/7/10 Dimitri Fontaine dimi...@2ndquadrant.fr: I'm not sure I can understand the difference between that and the use case for which you want to implement DO blocks with parameters. this is similar to temporary functions - you need some

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Alvaro Herrera
Excerpts from Tom Lane's message of mar jul 10 10:56:50 -0400 2012: Pavel Stehule pavel.steh...@gmail.com writes: 2012/7/10 Dimitri Fontaine dimi...@2ndquadrant.fr: I'm not sure I can understand the difference between that and the use case for which you want to implement DO blocks with

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-10 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: Excerpts from Tom Lane's message of mar jul 10 10:56:50 -0400 2012: What's to solve? Presumably the WITH function name would take precedence over anything in the catalogs, the same as WITH query names take precedence over actual tables. Hm,

[HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Pavel Stehule
Hello When I worked on parametrised DO statement, I had to solve following issue: Syntax is: DO (param list) $$ ... $$ LANGUAGE ... USING expr_list What is correct way for evaluation of expr_list with specified target types? I used two techniques: 1) evaluation expressions -

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: When I worked on parametrised DO statement, I had to solve following issue: Syntax is: DO (param list) $$ ... $$ LANGUAGE ... USING expr_list What is correct way for evaluation of expr_list with specified target types? I'd argue that that's a

Re: [HACKERS] expression evaluation with expected datatypes

2012-07-08 Thread Pavel Stehule
2012/7/8 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: When I worked on parametrised DO statement, I had to solve following issue: Syntax is: DO (param list) $$ ... $$ LANGUAGE ... USING expr_list What is correct way for evaluation of expr_list with specified