Re: Using row_to_json with %ROWTYPE ? - Mailing list pgsql-general

From David Johnston
Subject Re: Using row_to_json with %ROWTYPE ?
Date
Msg-id CAKFQuwZd=6TPtTaFwFbc3mrioRd=GP_xYpyLLdrBQuR7k0ZdFQ@mail.gmail.com
Whole thread Raw
In response to Re: Using row_to_json with %ROWTYPE ?  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Fri, Feb 6, 2015 at 10:23 AM, Adrian Klaver <adrian.klaver@aklaver.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.


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Using row_to_json with %ROWTYPE ?
Next
From: Tim Smith
Date:
Subject: Re: Using row_to_json with %ROWTYPE ?