- bash command
The "declare/set/select" bash commands are equal to SQL words. In pgbash, since SQL statement is prior handled, the bash commands name have been changed as follows.
bash declare command ==> declares
bash set command ==> sets
bash select command ==> selects
Shell variables
(1) SQLCODE shell variable
SQLCODE shell variable($SQLCODE etc.) has the SQL result code. But, if SQL is executed with a pipeline or backgroup job, SQLCODE shell variable can not be saved.
ex)
pgbash> select * from test; | more ..... pipeline
pgbash> echo $SQLCODE (または ?s) .. can not use $SQLCODE
pgbash> select * from test; & ........... background job
pgbash> echo $SQLCODE (または ?s) ...can not use $SQLCODE
(2) Shell variables which receive the retrieval result
If SQL is executed with a pipeline or background job, then you can not get retrieval results.
pgbash> select col1,col2 into :aa, :bb from test; | more
... can not get retrieval results
pgbash> select col1,col2 into :aa, :bb from test; &
... can not get retrieval results
(3) Shell variable which the user uses
Since Pgbash is using the shell variable of an English capital letter,
it is better that English small letter is used as a shell variable which a user uses.
Version and compatibility of PostgreSQL
Pgbash is suitable for PostgreSQL-7.x.
|