From 41e198b429b909ecdb84e4c5e313cdc328adb68f Mon Sep 17 00:00:00 2001 From: Andrey Klychkov Date: Fri, 2 Aug 2019 21:30:17 +0300 Subject: [PATCH] Issue 59955: add example to postgresql_query module (#59979) --- .../modules/database/postgresql/postgresql_query.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/database/postgresql/postgresql_query.py b/lib/ansible/modules/database/postgresql/postgresql_query.py index 60ba9551d9e..633873fd548 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_query.py +++ b/lib/ansible/modules/database/postgresql/postgresql_query.py @@ -94,10 +94,10 @@ EXAMPLES = r''' id_val: 1 story_val: test -- name: Insert query to db test_db +- name: Insert query to test_table in db test_db postgresql_query: db: test_db - query: INSERT INTO test_db (id, story) VALUES (2, 'my_long_story') + query: INSERT INTO test_table (id, story) VALUES (2, 'my_long_story') - name: Run queries from SQL script postgresql_query: @@ -111,6 +111,14 @@ EXAMPLES = r''' db: test_db query: VACUUM autocommit: yes + +- name: > + Insert data to the column of array type using positional_args. + Note that we use quotes here, the same as for passing JSON, etc. + postgresql_query: + query: INSERT INTO test_table (array_column) VALUES (%s) + positional_args: + - '{1,2,3}' ''' RETURN = r'''