File: psql_1.out

package info (click to toggle)
postgresql-plsh 1.20140221-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 228 kB
  • ctags: 51
  • sloc: ansic: 556; sql: 136; makefile: 40; sh: 13
file content (14 lines) | stat: -rw-r--r-- 315 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE TABLE pbar (a int, b text);
INSERT INTO pbar VALUES (1, 'one'), (2, 'two');
CREATE FUNCTION query (x int) RETURNS text
LANGUAGE plsh
AS $$
#!/bin/sh
if which psql >/dev/null; then
    psql -At -c "select b from pbar where a = $1"
else
    echo 'no PATH?' 1>&2
fi
$$;
SELECT query(1);
ERROR:  query: no PATH?