[GENERAL] json function question

2016-02-23 Thread Dan S
store it works well. I have this table, data and query: create table test ( id int, txt text, txt_arr text[], f float ); insert into test values (1,'jkl','{abc,def,fgh}',3.14159),(2,'hij','{abc,def,fgh}',3.14159),(2,null,null,null),(3,'def',null,0); select j, json_populate_record(null::test, j) from ( select to_json(t) as j from test t ) r Best Regards Dan S

Re: [GENERAL] json function question

2016-02-23 Thread Dan S
Yes I meant equivalence in the roundtrip conversion sense. And of course the "feature complete" solution which can handle deep structures would be really nice to have. Best Regards Dan S 2016-02-23 21:11 GMT+01:00 David G. Johnston : > On Tue, Feb 23, 2016 at 12:54 PM, To

[GENERAL] How do I do this in plpgsql ?

2011-03-18 Thread Dan S
Hi ! Is there a way to use plpgsql copy type to get an array of a certain type ? For example if I have a type sample%TYPE How can I declare a variable that is an array of sample%TYPE I can't get it to work, is there a way to do it ? Best Regards Dan S

Re: [GENERAL] How do I do this in plpgsql ?

2011-03-18 Thread Dan S
way then. Thank you Merlin and Pavel for your quick answers Dan S 2011/3/18 Merlin Moncure > On Fri, Mar 18, 2011 at 2:20 PM, Dan S wrote: > > Hi ! > > > > Is there a way to use plpgsql copy type to get an array of a certain type > ? > > > > For example if I

[GENERAL] strange result from query, bug ?

2014-07-28 Thread Dan S
clause expression is volatile ? Best Regards Dan S P.S. I've since rewritten the query like below to get the expected results but I still thought I should ask if it is a bug. with cte as ( select generate_series,(random()*999.0)::int + 1 as id from generate_series(1,1000) ) select (select

Re: [GENERAL] strange result from query, bug ?

2014-07-28 Thread Dan S
Ahh yes, I understand now. Thanks ! Best Regards Dan S 2014-07-28 18:28 GMT+02:00 Tom Lane : > Dan S writes: > > I've run into a strange problem with a query. > > I wonder if it might be a bug or a misunderstanding from my side. > > > Steps to recreate th

[GENERAL] question about window function in C

2014-12-26 Thread Dan S
n is, how do I shut down the tuplesort properly after the last call to my window function ? I'm running "PostgreSQL 9.3.5 on i686-pc-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 32-bit" Best Regards Dan S

Re: [GENERAL] question about window function in C

2014-12-26 Thread Dan S
an be used to answer questions like what are the maximum number of simultaneously overlapping ranges and at which ranges the maximum occurs) Best Regards Dan S 2014-12-26 18:57 GMT+01:00 Tom Lane : > Dan S writes: > > I'm trying to write a window function in C . > > In the fu

Re: [GENERAL] question about window function in C

2014-12-27 Thread Dan S
2014-12-27 6:43 GMT+01:00 Merlin Moncure : > On Fri, Dec 26, 2014 at 11:41 PM, Merlin Moncure > wrote: > > On Fri, Dec 26, 2014 at 1:19 PM, Dan S wrote: > >> Well I'm trying to implement a window-function that works on > range_types and > >> produce

[GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Dan S
tmt := 'select * from tbl1 '; IF (i IS NOT NULL) THEN cond := ' col1 < $1 '; END IF; IF (cond IS NOT NULL) THEN stmt := stmt || 'where ' || cond; END IF; RETURN QUERY EXECUTE stmt USING i; RETURN; END; $$ language plpgsql; select * from dynamic_query(4); Best Regards Dan S

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Dan S
Yes throwing an error would probably be good to catch these kind of mistakes which silently gives you the wrong answer otherwise. Best Regards Dan S 2011/5/21 Tom Lane > Dan S writes: > > And yes I do know that I can fix the problem by renaming the output > column > > to s

[GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
on_schema.parameters p where r.routine_name = 'test' and p.specific_name = r.specific_name and p.specific_catalog=r.specific_catalog and p.specific_schema=r.specific_schema Best Regards Dan S

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
So is there always an underscore prepended to the type name of an array ? for example float[] would then be _float right ? Best Regards Dan S 2011/5/21 Pavel Stehule > Hello > > type "array of text" has name "_text" > > Regards > > Pavel Stehule &

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
Is there any examples of how to join the system tables to get the same information as I was trying to get from the function ? Best Regards Dan S 2011/5/21 Pavel Stehule > 2011/5/21 Dan S : > > So is there always an underscore prepended to the type name of an array ? > > fo

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
I'll try that . Thank you very much for your help. Best Regards Dan S 2011/5/21 Pavel Stehule > 2011/5/21 Dan S : > > > > Is there any examples of how to join the system tables to get the same > > information as I was trying to get from the function ? > > you c

Re: [GENERAL] Bug in GET STACKED DIAGNOSTICS ?

2012-12-11 Thread Dan S
It would be nice with a consistent behaviour, with the callstack always looking the same despite different causes of the exception. I think it is violating the 'Principle of least astonishment' . Best Regards Dan S 2012/12/11 Pavel Stehule > Hello > > 2012/12/10 Dan S : &

Re: [GENERAL] Bug in GET STACKED DIAGNOSTICS ?

2012-12-11 Thread Dan S
I got another unexpected behaviour of the call stack by this invocation : select testfunc2(true) from generate_series(1,10); The first call stack is different from the nine folllowing. Shouldn't it be identical to the others ? Best Regards Dan S 2012/12/11 Pavel Stehule > Hello >

[GENERAL] timestamp convert to date

2010-04-30 Thread Dan S
Hi List ! I'm running "PostgreSQL 8.3.10 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Ubuntu 4.3.3-5ubuntu4) 4.3.3" (Ubuntu 9.04) I want to use -infinity,infinity as my date interval maximum endpoints in an application I'm writing . Is it possible to use date ? I did a test but it looks li

Re: [GENERAL] timestamp convert to date

2010-04-30 Thread Dan S
ks now. Is there a description or manual page on how to install a beta in paralell with my 8.3.10 installation ? regards //Dan 2010/4/30 Tom Lane > Dan S writes: > > I did a test but it looks like date doesn't support infinity as a value. > > Try 8.4 or later. > >regards, tom lane >