pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to prompt for a value if a variable is not set
2+ messages / 2 participants
[nested] [flat]

* How to prompt for a value if a variable is not set
@ 2017-09-19 03:03 randy@strausses.net
  2017-09-20 15:07 ` Re: How to prompt for a value if a variable is not set David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: randy@strausses.net @ 2017-09-19 03:03 UTC (permalink / raw)
  To: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.2/static/app-psql.html
Description:

I want to make a small script to show the primary key for a table and put
the name into a variable.

Called from another script, the tablename is set in a variable called
tablename.  But if the variable is not set, I want the script to prompt for
it.

Is there a way to do this?
thx,
-r

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to prompt for a value if a variable is not set
  2017-09-19 03:03 How to prompt for a value if a variable is not set randy@strausses.net
@ 2017-09-20 15:07 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2017-09-20 15:07 UTC (permalink / raw)
  To: randy@strausses.net <randy@strausses.net>; +Cc: pgsql-docs

On Monday, September 18, 2017, <randy@strausses.net> wrote:
>
> But if the variable is not set, I want the script to prompt for
> it.


In version 10 this should be doable, we introduced \if conditionals.  You
might be able to hack up something via "\!" in 9.6 and earlier (haven't
tried it myself).

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-09-20 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 03:03 How to prompt for a value if a variable is not set randy@strausses.net
2017-09-20 15:07 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox