Re: Datum problem
От | Martijn van Oosterhout |
---|---|
Тема | Re: Datum problem |
Дата | |
Msg-id | 20061109174314.GB23352@svana.org обсуждение исходный текст |
Ответ на | Datum problem (Enrico <scotty@linuxtime.it>) |
Список | pgsql-general |
On Thu, Nov 09, 2006 at 06:12:08PM +0100, Enrico wrote: > Hi, > I'm newbie of programming postgresql sever side, > I write the function below and when I execute > > SELECT (anag_art, 150) AS esistenza from anag_art order by 1; > > result is something about this: Well, you didn't actually call any function, so it just returned the two parameters as you asked... You have other problems though. > visualizza_esistenza(PG_FUNCTION_ARGS) > { > HeapTupleHeader t = PG_GETARG_HEAPTUPLEHEADER(0); > int16 limit = PG_GETARG_INT16(1); An "integer" is not an "int16", so this is wrong, you want INT32 > bool isnull; > Datum esistenza; > int16 es; > > esistenza = GetAttributeByName(t, "esistenza", &isnull); > es = DatumGetInt16(esistenza); Possibly same problem here. > if (esistenza > limit) > PG_RETURN_INT16(es); You declared you were going to return an int4, yet you're returing something else. > } What are you returning if the if statement doesn't get run? Hope this helps, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Вложения
В списке pgsql-general по дате отправления: