Capturing the result status of an ALTER command in plpgsql

Поиск
Список
Период
Сортировка
От jarednevans@yahoo.com
Тема Capturing the result status of an ALTER command in plpgsql
Дата
Msg-id cfte1h$6m8@odah37.prod.google.com
обсуждение исходный текст
Список pgsql-novice
How does one capture the result status of an ALTER command inside
plpgsql code block?

For example:

-----------------
CREATE OR REPLACE FUNCTION public."Setup_Primary_Keys"()
RETURNS SETOF varchar AS
'DECLARE

BEGIN

ALTER TABLE public."HCM00101"  ADD CONSTRAINT "hcm00101-pk" PRIMARY
KEY("CUSTNMBR");
-- Capture Success or Failure here of the ALTER command
IF [how do I determine success here?] THEN
return next \'HCM00101 primary key set\';
ELSE [eat the failure exception here and continue]
return next \'HCM00101 primary key was not set, continuing with more
code below\';
END IF;

....... more code ........
return;

END;'
  LANGUAGE 'plpgsql' VOLATILE;
-------------------


В списке pgsql-novice по дате отправления:

Предыдущее
От: the inquirer
Дата:
Сообщение: Authentication problems
Следующее
От: jarednevans@yahoo.com
Дата:
Сообщение: return set different in psql and MS Access/ODBC