Re: [DOCS] nothing ever works

2017-06-22 Thread Pavel Stehule
2017-06-22 10:00 GMT+02:00 Gerard Matthews : > Here's an example. this code does not exec for me, I get syntax error. I > have PG version 9.5 > > DO $$ > BEGIN > > EXEC SQL BEGIN DECLARE SECTION; > const char *stmt = "CREATE TABLE test1 (...);"; > EXEC SQL END DECLARE SECTION; > EXEC SQL EXECUTE I

Re: [DOCS] nothing ever works

2017-06-22 Thread Pavel Stehule
2017-06-22 13:29 GMT+02:00 Gerard Matthews : > It's under this page on the docs https://www.postgresql. > org/docs/9.1/static/ecpg-dynamic.html. > > It does not make it clear where this code can be executed. It's in the > documentation under chapter 33.5. Dynamic SQL. If you search in google for >

Re: [DOCS] gen_random_uuid security not explicit in documentation

2017-06-22 Thread Heikki Linnakangas
On 01/03/2017 02:47 PM, Michael Paquier wrote: (Adding Heikki in CC who committed this code) On Mon, Jan 2, 2017 at 8:20 AM, wrote: The C source code of gen_random_uuid reads: /* * Generate random bits. pg_backend_random() will do here, we don't * promis UUIDs to be cryptographic

Re: [DOCS] nothing ever works

2017-06-22 Thread Gerard Matthews
It's the same with this as well. All the dynamic SQL examples use Exec SQL declare begin and end section which return syntax errors for me. CREATE FUNCTION exec() RETURNS void AS $$ BEGIN RAISE NOTICE 'Performing Exec'; EXEC SQL BEGIN DECLARE SECTION; const char *stmt = "CREATE TABLE test1 (...);

Re: [DOCS] nothing ever works

2017-06-22 Thread Gerard Matthews
Hi Everyone, Firstly I would like to thank everyone for your feedback. Secondly I would like to apologise, I had spent some time trying to write some dynamic SQL in postgres yesterday and got extremely frustrated at the the time I wasted. I realize this a community and I'm sorry for not being more

Re: [DOCS] nothing ever works

2017-06-22 Thread Gerard Matthews
Here's an example. this code does not exec for me, I get syntax error. I have PG version 9.5 DO $$ BEGIN EXEC SQL BEGIN DECLARE SECTION; const char *stmt = "CREATE TABLE test1 (...);"; EXEC SQL END DECLARE SECTION; EXEC SQL EXECUTE IMMEDIATE :stmt; END; $$; [image: image.png] On Thu, 22 Jun 2

Re: [DOCS] nothing ever works

2017-06-22 Thread Gerard Matthews
It's under this page on the docs https://www.postgresql.org/docs/9.1/static/ecpg-dynamic.html. It does not make it clear where this code can be executed. It's in the documentation under chapter 33.5. Dynamic SQL. If you search in google for postgres dynamic sql it's the first link. Here is link to

Re: [DOCS] nothing ever works

2017-06-22 Thread Joe Conway
On 06/22/2017 04:29 AM, Gerard Matthews wrote: > It's under this page on the > docs https://www.postgresql.org/docs/9.1/static/ecpg-dynamic.html. Perhaps a bit confusing but notice the title in the top middle of the page: "Chapter 33. ECPG - Embedded SQL in C" That is definitely not what you are

Re: [DOCS] gen_random_uuid security not explicit in documentation

2017-06-22 Thread Michael Paquier
On Fri, Jun 23, 2017 at 3:02 AM, Heikki Linnakangas wrote: > I'm inclined to change gen_random_uuid() to throw an error if the server is > built with --disable-strong-random, like gen_random_bytes() does. That way, > they would behave the same. No objections to do that. I guess you don't need a p