Is there a way to retrieve user input for postgresql? I have done a search online and found that one can use:
select * from mytable where user_id = [parameter "Enter text question here"]
--or--
select * from mytable where user_id ~* '[parameter "Enter text question here"]'
However, when I type these on a command line prompt, I get errors. The above lines are mentioned when using a gui tool (like pgaccess). I cannot seem to get these to work from the command line.
Example:
WEBWX=# select * from package where package_id=1;
This does produce an output.
If I try:
WEBWX=# select * from package where package_id=[parameter "Enter package_id"]
WEBWX-# 1;
ERROR: syntax error at or near "[" at character 40
WEBWX=# select * from package where package_id ~* '[parameter "Enter id"]'
WEBWX-# 1;
ERROR: syntax error at or near "1" at character 68
WEBWX=#
I do notice that the prompt changes from =# to -#, but cannot figure out how to get it to work. Are these commands not available from the command line (and only available in the gui tools)?
Thank you so much for everyone's help!
select * from mytable where user_id = [parameter "Enter text question here"]
--or--
select * from mytable where user_id ~* '[parameter "Enter text question here"]'
However, when I type these on a command line prompt, I get errors. The above lines are mentioned when using a gui tool (like pgaccess). I cannot seem to get these to work from the command line.
Example:
WEBWX=# select * from package where package_id=1;
This does produce an output.
If I try:
WEBWX=# select * from package where package_id=[parameter "Enter package_id"]
WEBWX-# 1;
ERROR: syntax error at or near "[" at character 40
WEBWX=# select * from package where package_id ~* '[parameter "Enter id"]'
WEBWX-# 1;
ERROR: syntax error at or near "1" at character 68
WEBWX=#
I do notice that the prompt changes from =# to -#, but cannot figure out how to get it to work. Are these commands not available from the command line (and only available in the gui tools)?
Thank you so much for everyone's help!