Re: Using row_to_json with %ROWTYPE ?

From: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tim Smith <randomdev4+postgres(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using row_to_json with %ROWTYPE ?
Date: 2015-02-06 17:44:09
Message-ID: CAKFQuwZd=6TPtTaFwFbc3mrioRd=GP_xYpyLLdrBQuR7k0ZdFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 6, 2015 at 10:23 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

>
>> CREATE FUNCTION validateSession(session_id char(64),client_ip
>> inet,user_agent char(40),forcedTimeout bigint,sessionTimeout bigint)
>> RETURNS json AS $$
>>
>

> CREATE OR REPLACE FUNCTION public.validatesession(s_id character,
> client_ip inet, user_agent character, forcedtimeout bigint, sessiontimeout
> bigint)
> RETURNS json
>
>
​As an aside, and going from memory, you will note that Adrian kept the
"character" type in the function signature​

​but removed the length specifier. PostgreSQL does not store that
information and so will not prevent a call from passing in a string longer
than 64 characters into the function. This applies to any specification in
() following a type declaration (say for numeric or timestamptz)

David J.


In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Smith 2015-02-06 18:26:21 Re: Using row_to_json with %ROWTYPE ?
Previous Message Adrian Klaver 2015-02-06 17:23:30 Re: Using row_to_json with %ROWTYPE ?