diff --git a/samples/snippets/psql-snippets/add_column.sh b/samples/snippets/psql-snippets/add_column.sh old mode 100644 new mode 100755 index 080d314ae1..acfff9e104 --- a/samples/snippets/psql-snippets/add_column.sh +++ b/samples/snippets/psql-snippets/add_column.sh @@ -1,7 +1,7 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql -c "ALTER TABLE albums ADD COLUMN marketing_budget bigint" diff --git a/samples/snippets/psql-snippets/create_connection.sh b/samples/snippets/psql-snippets/create_connection.sh old mode 100644 new mode 100755 index 0182937a77..8210b891c6 --- a/samples/snippets/psql-snippets/create_connection.sh +++ b/samples/snippets/psql-snippets/create_connection.sh @@ -3,9 +3,9 @@ # Set the connection variables for psql. # The following statements use the existing value of the variable if it has # already been set, and otherwise assigns a default value. -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Connect to Cloud Spanner using psql through PGAdapter # and execute a simple query. diff --git a/samples/snippets/psql-snippets/create_tables.sh b/samples/snippets/psql-snippets/create_tables.sh old mode 100644 new mode 100755 index 020dfc6e00..e60ac6b56d --- a/samples/snippets/psql-snippets/create_tables.sh +++ b/samples/snippets/psql-snippets/create_tables.sh @@ -3,9 +3,9 @@ # Set the connection variables for psql. # The following statements use the existing value of the variable if it has # already been set, and otherwise assigns a default value. -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Create two tables in one batch. psql << SQL diff --git a/samples/snippets/psql-snippets/data_boost.sh b/samples/snippets/psql-snippets/data_boost.sh old mode 100644 new mode 100755 index 6062ff2e87..87ffb86877 --- a/samples/snippets/psql-snippets/data_boost.sh +++ b/samples/snippets/psql-snippets/data_boost.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # 'set spanner.data_boost_enabled=true' enables Data Boost for # all partitioned queries on this connection. diff --git a/samples/snippets/psql-snippets/ddl_batch.sh b/samples/snippets/psql-snippets/ddl_batch.sh old mode 100644 new mode 100755 index b83df784bc..519718086e --- a/samples/snippets/psql-snippets/ddl_batch.sh +++ b/samples/snippets/psql-snippets/ddl_batch.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Use a single SQL command to batch multiple statements together. # Executing multiple DDL statements as one batch is more efficient diff --git a/samples/snippets/psql-snippets/partitioned_dml.sh b/samples/snippets/psql-snippets/partitioned_dml.sh old mode 100644 new mode 100755 index b0feb88035..6e3ebc056c --- a/samples/snippets/psql-snippets/partitioned_dml.sh +++ b/samples/snippets/psql-snippets/partitioned_dml.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Change the DML mode that is used by this connection to Partitioned # DML. Partitioned DML is designed for bulk updates and deletes. diff --git a/samples/snippets/psql-snippets/query_data.sh b/samples/snippets/psql-snippets/query_data.sh old mode 100644 new mode 100755 index 14ff290f25..8ba8a5408f --- a/samples/snippets/psql-snippets/query_data.sh +++ b/samples/snippets/psql-snippets/query_data.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql -c "SELECT singer_id, album_id, album_title FROM albums" diff --git a/samples/snippets/psql-snippets/query_data_with_new_column.sh b/samples/snippets/psql-snippets/query_data_with_new_column.sh new file mode 100755 index 0000000000..e9904777b0 --- /dev/null +++ b/samples/snippets/psql-snippets/query_data_with_new_column.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" + +psql -c "SELECT singer_id, album_id, marketing_budget + FROM albums + ORDER BY singer_id, album_id" diff --git a/samples/snippets/psql-snippets/query_data_with_parameter.sh b/samples/snippets/psql-snippets/query_data_with_parameter.sh old mode 100644 new mode 100755 index 81e0d8baf3..d853aa6acf --- a/samples/snippets/psql-snippets/query_data_with_parameter.sh +++ b/samples/snippets/psql-snippets/query_data_with_parameter.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Create a prepared statement to use a query parameter. # Using a prepared statement for executing the same SQL string multiple diff --git a/samples/snippets/psql-snippets/read_only_transaction.sh b/samples/snippets/psql-snippets/read_only_transaction.sh old mode 100644 new mode 100755 index 5ad5af8f12..306967d52b --- a/samples/snippets/psql-snippets/read_only_transaction.sh +++ b/samples/snippets/psql-snippets/read_only_transaction.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql << SQL -- Begin a transaction. diff --git a/samples/snippets/psql-snippets/statement_timeout.sh b/samples/snippets/psql-snippets/statement_timeout.sh old mode 100644 new mode 100755 index b2a88ec81b..1d690af54d --- a/samples/snippets/psql-snippets/statement_timeout.sh +++ b/samples/snippets/psql-snippets/statement_timeout.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Set the statement timeout that should be used for all statements # on this connection to 5 seconds. diff --git a/samples/snippets/psql-snippets/tags.sh b/samples/snippets/psql-snippets/tags.sh old mode 100644 new mode 100755 index 60e84099b0..f97b4fea77 --- a/samples/snippets/psql-snippets/tags.sh +++ b/samples/snippets/psql-snippets/tags.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql << SQL -- Start a transaction. diff --git a/samples/snippets/psql-snippets/update_data_with_copy.sh b/samples/snippets/psql-snippets/update_data_with_copy.sh old mode 100644 new mode 100755 index b2126c9199..7455b78dbf --- a/samples/snippets/psql-snippets/update_data_with_copy.sh +++ b/samples/snippets/psql-snippets/update_data_with_copy.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Instruct PGAdapter to use insert-or-update for COPY statements. # This enables us to use COPY to update data. diff --git a/samples/snippets/psql-snippets/update_data_with_transaction.sh b/samples/snippets/psql-snippets/update_data_with_transaction.sh old mode 100644 new mode 100755 index eaff993d6a..2fb040e9d2 --- a/samples/snippets/psql-snippets/update_data_with_transaction.sh +++ b/samples/snippets/psql-snippets/update_data_with_transaction.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql << SQL -- Transfer marketing budget from one album to another. diff --git a/samples/snippets/psql-snippets/write_data_with_copy.sh b/samples/snippets/psql-snippets/write_data_with_copy.sh old mode 100644 new mode 100755 index 6d2c65aea2..730277b1a0 --- a/samples/snippets/psql-snippets/write_data_with_copy.sh +++ b/samples/snippets/psql-snippets/write_data_with_copy.sh @@ -3,9 +3,9 @@ # Get the source directory of this script. directory=${BASH_SOURCE%/*}/ -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Copy data to Spanner from a tab-separated text file using the COPY command. psql -c "COPY singers (singer_id, first_name, last_name) FROM STDIN" \ diff --git a/samples/snippets/psql-snippets/write_data_with_dml.sh b/samples/snippets/psql-snippets/write_data_with_dml.sh old mode 100644 new mode 100755 index 13c4506f09..38e6a4350f --- a/samples/snippets/psql-snippets/write_data_with_dml.sh +++ b/samples/snippets/psql-snippets/write_data_with_dml.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" psql -c "INSERT INTO singers (singer_id, first_name, last_name) VALUES (12, 'Melissa', 'Garcia'), diff --git a/samples/snippets/psql-snippets/write_data_with_dml_batch.sh b/samples/snippets/psql-snippets/write_data_with_dml_batch.sh old mode 100644 new mode 100755 index f08f361478..2c44f17c70 --- a/samples/snippets/psql-snippets/write_data_with_dml_batch.sh +++ b/samples/snippets/psql-snippets/write_data_with_dml_batch.sh @@ -1,8 +1,8 @@ #!/bin/bash -PGHOST="${PGHOST:-localhost}" -PGPORT="${PGPORT:-5432}" -PGDATABASE="${PGDATABASE:-example-db}" +export PGHOST="${PGHOST:-localhost}" +export PGPORT="${PGPORT:-5432}" +export PGDATABASE="${PGDATABASE:-example-db}" # Create a prepared insert statement and execute this prepared # insert statement three times in one SQL string. The single