Схема «ТБ» не существует.для tb.DOWName.В этом запросе 3 таблицы.
Хранимая процедура:
CREATE OR REPLACE PROCEDURE MeetingList ( INT, INT, VARCHAR(25))
LANGUAGE plpgsql
AS $$
BEGIN
SELECT ListID,
a.DOWID,
tb.DOWName 'Day',
a.aTimeID,
c.aTime 'Time',
Town,
GroupName,
Information,Location,Type
FROM list a
INNER JOIN dow tb ON a.DOWID = tb.DOWID
INNER JOIN atime AS c ON a.aTimeID = c.aTimeId
WHERE (a.DOWID = $1 OR $1 IS NULL)
AND (a.aTimeID = $2 or $2 IS NULL)
AND (Town = $3 or $3 IS NULL)
ORDER BY a.DOWID,a.aTimeID, Town;
END;
$$;
Результат запроса:
deig=# CALL MeetingList(1,60,'Ellsworth');
ERROR: schema "tb" does not exist
LINE 3: tb.DOWName 'Day',
^
QUERY: SELECT ListID,
a.DOWID,
public.tb.DOWName 'Day',
a.aTimeID,
c.aTime 'Time',
Town,
GroupName,
Information,Location,Type
FROM list a
INNER JOIN dow tb ON a.DOWID = tb.DOWID
INNER JOIN atime AS c ON a.aTimeID = c.aTimeId
WHERE (a.DOWID = $1 OR $1 IS NULL)
AND (a.aTimeID = $2 or $2 IS NULL)
AND (Town = $3 or $3 IS NULL)
ORDER BY a.DOWID,a.aTimeID, Town
CONTEXT: PL/pgSQL function meetinglist(integer,integer,character
varying) line 3 at SQL statement
Я запускаю это из psql как пользователь 'bart', используя базу данных 'deig'.Существует 3 таблицы:
Schema | Name | Type | Owner
--------+-------+-------+----------
public | atime | table | bart
public | dow | table | bart
public | list | table | bart```
Я использовал эту хранимую процедуру в SQL Express, но не смог выполнить Postgresql 11.