Hello,
why does this fail in PostgreSQL 9.5 please?CREATE OR REPLACE FUNCTION words_unban_user(
in_uid integer)
RETURNS integer AS
$func$
UPDATE words_users SET
banned_until = null,
banned_reason = null
WHERE uid = in_uid
RETURNING uid; -- returns the user to be notified
$func$ LANGUAGE sql;
in_uid integer)
RETURNS integer AS
$func$
UPDATE words_users SET
banned_until = null,
banned_reason = null
WHERE uid = in_uid
RETURNING uid; -- returns the user to be notified
$func$ LANGUAGE sql;
words=> TABLE words_users;
uid | created | visited | ip | vip_until | grand_until | banned_until | banned_reason | win | loss | draw | elo | medals | green | red | coins
-----+-----------------------------+-----------------------------+-----------+-----------+-------------+-----------------------------+---------------+-----+------+------+------+--------+-------+-----+-------
1 | 2016-12-02 10:33:59.0761+01 | 2016-12-02 10:36:36.3521+01 | 127.0.0.1 | | | 2016-12-09 10:34:09.9151+01 | ban user 1 | 0 | 0 | 0 | 1500 | 0 | 0 | 0 | 0
(1 row)
uid | created | visited | ip | vip_until | grand_until | banned_until | banned_reason | win | loss | draw | elo | medals | green | red | coins
-----+-----------------------------+-----------------------------+-----------+-----------+-------------+-----------------------------+---------------+-----+------+------+------+--------+-------+-----+-------
1 | 2016-12-02 10:33:59.0761+01 | 2016-12-02 10:36:36.3521+01 | 127.0.0.1 | | | 2016-12-09 10:34:09.9151+01 | ban user 1 | 0 | 0 | 0 | 1500 | 0 | 0 | 0 | 0
(1 row)
words=> SELECT uid FROM words_unban_user(1);
ERROR: column "uid" does not exist
LINE 1: SELECT uid FROM words_unban_user(1);
^
ERROR: column "uid" does not exist
LINE 1: SELECT uid FROM words_unban_user(1);
^