Re: plpgsql FOR
Список
Период
Сортировка

От Justin Banks
Тема Re: plpgsql FOR
Дата
Msg-id 14598.64235.855414.366754@flotsam.cops.wamnet.com
обсуждение исходный текст
Ответ на Re: plpgsql FOR
Список pgsql-general
<courtesy copy emailed to wieck@debis.com>

>>>>> "Jan" == Jan Wieck <wieck@debis.com> writes:

    >> Hello - After reading the documentation several times, and
    >> looking at the archives, I'm very confused. The PL/pgSQL
    >> documentation states that :

    Jan>     Looks like you're confused.

Yup, I was.

    >> FOR lgid IN select gid from groups_acl where login = NEW.login LOOP
    >>   ...<do stuff with lgid>...

    Jan>     Here you have the syntax right, but I assume "lgid" isn't
    Jan> a record or row type variable.

Actually, it wasn't, that's where I was confused. I had thought that
since I knew the datatype I was selecting, declaring a variable of
that type was sufficient. Apparently it's not ;)

    Jan>     This time you messed up the syntax. Write it as

    Jan>     FOR rec IN select * from groups_acl where login =
    Jan> NEW.login LOOP ...  END LOOP;

What I wanted was to be pedantic about the datatype I was selecting
(for no particular reason, I guess), but now I understand that I've
got to have something of the general type record.

Of course, as always happens, right after I mailed to the list, I
figured it out myself.

Thanks.

-justinb

--
Justin Banks - WAM!NET Inc., Eagan MN justinb@wamnet.com
I'd fix it for you, but I don't want to break into your site.


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: RE: unique row identifier data type exhausted . . .
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: pgsql DATE