[GENERAL] valgrind

2015-06-18 Thread Peter Kroon
Hi list, I've Installed postgresql-9.4 using apt-get as instructed here: http://www.postgresql.org/download/linux/debian/ Also installed libpq-dev with the suggested dependencies using apt-get. And created a small program in c. You can find it here: http://pastebin.com/bRHw3Wud When I run the prog

[GENERAL] Fwd: dblink max per function

2015-07-05 Thread Peter Kroon
Hi, I've got a function with 5 dblink select statement all to my local server with the same connection string. When one more dblink select statement is added the query fails. Is there some kind of limit that I can configure? If so, which one an where? Thanks, Peter

Re: [GENERAL] dblink max per function

2015-07-06 Thread Peter Kroon
A restart of my system solved the matter. 2015-07-05 20:54 GMT+02:00 Peter Kroon : > Hi, > > I've got a function with 5 dblink select statement all to my local server > with the same connection string. > When one more dblink select statement is added the query fails. >

[GENERAL] conn = PQconnectdb(conninfo);

2015-07-17 Thread Peter Kroon
Hi, Every now and then my program will abort. IAnd this is because: conn = PQconnectdb(conninfo); The error given: *** Error in `./server_prog': malloc(): smallbin double linked list corrupted: 0x092c10a0 *** Any thoughts on why I'm getting this message? Regards, Peter

Re: [GENERAL] conn = PQconnectdb(conninfo);

2015-07-29 Thread Peter Kroon
RDS "PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit" The attachment is the program I've used for testing. 2015-07-18 0:15 GMT+02:00 Tom Lane : > Peter Kroon writes: > > Every now and then my program will abort. > > IAnd

Re: [GENERAL] conn = PQconnectdb(conninfo);

2015-07-31 Thread Peter Kroon
nstall of the db and libpq. Best, Peter 2015-07-31 12:05 GMT+02:00 Albe Laurenz : > Peter Kroon wrote: > > I've found perhaps a bug. > > I've narrowed down my code and the problem is indeed at: conn = > PQconnectdb(conninfo); > > > > My connection string:

[GENERAL] Identifier gets truncated

2013-01-10 Thread Peter Kroon
When an identifier has more then 63 chars it gets truncated. This is fine. However PostgreSQL fails to notice that it might truncate to an identifier which already exist. Does PostgreSQL got a setting that will never create a duplicate identifier? really_long_name_table_A -> really_long_na really_

[GENERAL] pg 9.2.4 dblink

2013-07-09 Thread Peter Kroon
Hi, I want to talk to multiple db's in one session. Is dblink the best solution or is there another way without installing dblink? Best, Peter

[GENERAL] xmlagg doesn't honor LIMIT?

2013-11-26 Thread Peter Kroon
Is anyone able to reproduce? When I run the query below all 5 rows are returned instead of 2. Or is this the default behaviour.. "PostgreSQL 9.2.4 on i686-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52), 32-bit" DROP TABLE IF EXISTS __pg_test_table CASCADE; CREATE TABLE __pg

Re: [GENERAL] xmlagg doesn't honor LIMIT?

2013-11-26 Thread Peter Kroon
)--test_element ) AS d --) FROM __pg_test_table AS dh WHERE dh.__rel=5 LIMIT 2 --OFFSET 10; ) AS ff; 2013/11/26 Albe Laurenz > Peter Kroon wrote: > > Is anyone able to reproduce? > > When I run the query below all 5 rows are returned instead of 2. > > Or is this the default beh

[GENERAL] pgadmin III query

2013-12-06 Thread Peter Kroon
When you click on a table in the "Object browser" you'll see in the "SQL pane" the sql that is needed to create that table. Which function can I call to get that SQL? Best, Peter

Re: [GENERAL] pgadmin III query

2013-12-06 Thread Peter Kroon
Thanks, but i need a non command line option. 2013/12/6 Ian Lawrence Barwick > 2013/12/6 Peter Kroon : > > When you click on a table in the "Object browser" you'll see in the "SQL > > pane" the sql that is needed to create that table. > > > >

Re: [GENERAL] pgadmin III query

2013-12-09 Thread Peter Kroon
Dinesh Kumar > Hi Peter, > > On Mon, Dec 9, 2013 at 7:03 PM, Peter Kroon wrote: > >> Hi Dinesh, >> >> >> >Get all the queries what it has performed. >> >> How and where? >> When I run "select * from pg_stat_activity" I g

[GENERAL] add parameter to existing function

2013-12-10 Thread Peter Kroon
Hi, I can use: create or replace function etc to alter a function. However, this will create a new function instead of replacing the old one when adding a parameter. Is this possible without the use of DROP and CASCADE? The function that I'm trying to alter is on some tables a default value.

[GENERAL] validate synatax

2013-12-10 Thread Peter Kroon
Hi, How can I validate any query on PostgreSQL without executing the sql. I was able with EXPLAIN to find some errors. However this only worked with a SELECT statement. When i tried to create a TABLE it would not run. I do not wish to install external packages. Preferably use only default present

Re: [GENERAL] validate synatax

2013-12-10 Thread Peter Kroon
uld be tested even if the syntax is correct. So 2 things to look for: - Syntax validator - Check query logic, like does the table exist Best, Peter 2013/12/10 Szymon Guz > > > > On 10 December 2013 22:40, Peter Kroon wrote: > >> Hi, >> >> How can I validate an

Re: [GENERAL] validate synatax

2013-12-11 Thread Peter Kroon
Perhaps creating a temporary table would be more efficient. Then the rollback isn't necessary. 2013/12/11 Jov > you can use the transition. > eg: > begin; > creat table(...); > catch error if the statement not validated. > rollback; > > jov > 在 2013-12-11

[GENERAL] get source of udf

2012-11-19 Thread Peter Kroon
Hi list, I would like to get the source of a udf. In mssql I run this query: SELECT OBJECT_DEFINITION(OBJECT_ID) FROM sys.objects WHERE name='function_name'; And I get the entire source of the function. How must I do this in PostgreSQL? Thanks, Peter

[GENERAL] declare variable in udf

2012-11-21 Thread Peter Kroon
Hello, How do I declare a variable after BEGIN? I want to declare it in the if statement. DROP FUNCTION IF EXISTS tmp_test(integer); CREATE FUNCTION tmp_test( p_id integer ) RETURNS text AS $$ DECLARE the_return_value text; BEGIN DROP TABLE IF EXISTS temp_test_table; CREATE TEMP TABLE temp_test_t

Re: [GENERAL] declare variable in udf

2012-11-21 Thread Peter Kroon
So, multiple DECLARE sections are not allowed? 2012/11/21 Raymond O'Donnell > On 21/11/2012 11:42, Peter Kroon wrote: > > Hello, > > > > How do I declare a variable after BEGIN? > > I want to declare it in the if statement. > > > > DROP FUNCTION IF E

[GENERAL] output inserted

2012-11-21 Thread Peter Kroon
How to I output the insert in PostgreSQL? DROP TABLE IF EXISTS a_001; CREATE TEMP TABLE a_001( vl text ); DROP TABLE IF EXISTS a_002; CREATE TEMP TABLE a_002( vl text ); INSERT INTO a_001 OUTPUT INSERTED.* INTO a_002 --mssql SELECT 'text for insertion'; SELECT vl FROM a_002;

[GENERAL] create table in memory

2012-11-23 Thread Peter Kroon
Is a temp table created to memory(ram) or disk? I've converted some msssq

Re: [GENERAL] create table in memory

2012-11-23 Thread Peter Kroon
I've converted some mssql functions and they appear to be slower in pgsql. I use a lot of declared tables in mssql as they are created in memory. Which makes it very fast. 2012/11/23 Peter Kroon > Is a temp table created to memory(ram) or disk? > I've converted some msssq >

[GENERAL] w7 vs linux

2012-11-23 Thread Peter Kroon
Is pgsql faster on linux? Currently I've made an installation on W7 and the converted queries are about 3 times slower then on mssql. There's still some optimization to do tho...but the current results don't look to good.

Re: [GENERAL] create table in memory

2012-11-23 Thread Peter Kroon
is a significant difference. Also I need those tables per session, so creating and dropping with TEMP tables appear to be faster. Best, Peter KRoon 2012/11/23 Raghavendra > > On Fri, Nov 23, 2012 at 2:43 PM, Peter Kroon wrote: > >> I've converted some mssql functions and th

[GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
Hello, I wish to return the SELECT statement. Ho can I achieve this? DO $$ DECLARE v_some_id int=14; BEGIN /* more queries here... */ SELECT 'this is text'; END $$ LANGUAGE plpgsql; Best, Peter Kroon

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
When using: RETURN QUERY( SELECT 'this is text' ); I get another error: ERROR: cannot use RETURN QUERY in a non-SETOF function 2012/11/23 Craig Ringer > On 11/23/2012 06:36 PM, Peter Kroon wrote: > > Hello, > > I wish to return the SELECT statement. > Ho can

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
arameters, returning void."* > * > * > Regars > Bartek > > Pozdrawiam, > Bartek > > > > 2012/11/23 Peter Kroon > >> Hello, >> >> I wish to return the SELECT statement. >> Ho can I achieve this? >> >> DO $$ >> >> DECLARE v_some_i

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
When using plain SQL I get this message: ERROR: language "sql" does not support inline code execution When removing the BEGIN+END block statements the message persists. 2012/11/23 Craig Ringer > On 11/23/2012 06:53 PM, Peter Kroon wrote: > > When using: > RETURN QUE

[GENERAL] Prevent x005F from xml

2012-11-23 Thread Peter Kroon
x005F in the tagname without changing the tagname? Best, Peter Kroon

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
Yes, but this means I have to create a function which is something I don't want. I just want to debug some of my code in the related function. So what I want is in pgAdmin declare some vars and run the sql and get the result. 2012/11/23 John R Pierce > On 11/23/12 2:53 AM, Peter Kro

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
Thanks, I'll have a look at this. 2012/11/23 Pavel Stehule > 2012/11/23 Peter Kroon : > > OK, but how do I run some SQL in pgAdmin with declared variables? > > pgAdmin has own client language similar to T-SQL > http://www.pgadmin.org/docs/dev/pgscript.html - but it is

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
OK, but how do I run some SQL in pgAdmin with declared variables? 2012/11/23 Pavel Stehule > 2012/11/23 Peter Kroon : > > So this means it's unable to return data? > > yes, it means :( > > DO "is" void function, so you cannot to return anything > > Re

[GENERAL] Npgsql

2012-11-23 Thread Peter Kroon
I've installed Npgsql via Application stack builder without a problem(I guess, no error messages seen). http://npgsql.projects.pgfoundry.org/docs/manual/UserManual.html The projectpage tells me I have to add: <%@ Assembly name="System.Data" %> <%@ Assembly name="Npgsql" %> When I do this I get

Re: [GENERAL] create table in memory

2012-11-23 Thread Peter Kroon
I found out that declaring tables outside of functions increases the execution time of the function. And CREATE UNLOGGED TABLE is very fast. 2012/11/23 Peter Kroon > I've put up a small test case for creating TEMP and UNLOGGED tables. > DROP TABLE IF EXISTS test CASCADE; > CRE

[GENERAL] alter sequence

2012-11-24 Thread Peter Kroon
ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH 1; The query fails: ALTER SEQUENCE (select pg_get_serial_sequence('table... it's because of the ( I guess I'm using the wrong syntax. It is possible this way? Would be great! Best, Peter

Re: [GENERAL] Prevent x005F from xml

2012-11-26 Thread Peter Kroon
I came up with this. select replace( xmlelement(name my_xslt_tag,(select xmlparse(content '')))::text ,'_x005F','')::xml; It works but it's not very fast. 2012/11/23 Peter Kroon > When I run this query: > SELECT > xmlelement(name my_xslt_tag, >

Re: [GENERAL] Npgsql

2012-11-26 Thread Peter Kroon
ng else. 2012/11/26 Glyn Astill > An actual error message would be useful, but did you add a reference to > the assembly in your project? > > > -- > *From:* Peter Kroon > *To:* "pgsql-general@postgresql.org" > *Sent:* Friday, 23 No

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-26 Thread Peter Kroon
>Reinterpreting the question and taking the pseudocode semi-literally is >the following closer to what was asked? No, I don't want to use/create a function. Best, Peter 2012/11/24 Gavan Schneider > On Friday, November 23, 2012 at 21:36, Peter Kroon wrote: > > Hello, &g

Re: [GENERAL] create table in memory

2012-11-26 Thread Peter Kroon
Could you provide an example? Fo me: Drop/Creat/populating tables inside a function are slow. Creating tables outside a function and populating he table inside a function is fast.. 2012/11/24 Craig Ringer > On 11/24/2012 02:15 AM, Peter Kroon wrote: > > I found out that declari

Re: [GENERAL] Npgsql

2012-11-26 Thread Peter Kroon
It appears to be installed. C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools>gacutil -l Npgsql Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.17626 Copyright (c) Microsoft Corporation. All rights reserved. The Global Assembly Cache contains the following as

Re: [GENERAL] Npgsql

2012-11-26 Thread Peter Kroon
m 26/11/2012 18:36, "Peter Kroon" escreveu: > > It appears to be installed. >> >> C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools>gacutil >> -l Npgsql >> Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.17626 &g

Re: [GENERAL] Npgsql

2012-11-26 Thread Peter Kroon
.security there? > > Sorry for not being very helpful. > Em 26/11/2012 18:51, "Peter Kroon" escreveu: > > Installed as well. >> >> C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools>gacutil >> -l mono.security >> Microsoft (R) .

[GENERAL] set value var via execute

2012-11-29 Thread Peter Kroon
Is it possible to set the value of a var via execute? drop table if exists __test; create unlogged table __test( id int ); DO $$ DECLARE v_holder int; v_table text = 'table'; v_record_0 text[]; v_id int; BEGIN execute ' insert into __test(id) select id from '||v_table||' order by random() l

Re: [GENERAL] set value var via execute

2012-11-29 Thread Peter Kroon
Go it: execute 'select id from '||v_table||' order by random() limit 1' into v_holder; 2012/11/29 Peter Kroon > --begin this > fails-- > v_holder = execu

[GENERAL] execute if statement

2012-12-01 Thread Peter Kroon
How can I achieve this? EXECUTE ' if 1=1 then raise notice ''%'', ''notice has been raised...''; end if; ';

Re: [GENERAL] execute if statement

2012-12-01 Thread Peter Kroon
M... How do I execute dynamic sql that starts with an if statement. I'm converting mssql code to pgsql. 2012/12/1 Raymond O'Donnell > On 01/12/2012 19:11, Peter Kroon wrote: > > How can I achieve this? > > > > EXECUTE ' > > > > if 1=

Re: [GENERAL] execute if statement

2012-12-01 Thread Peter Kroon
ails END; $$ LANGUAGE plpgsql; I do not wish to create a function for each query I have. 2012/12/1 Peter Kroon > M... > > How do I execute dynamic sql that starts with an if statement. > I'm converting mssql code to pgsql. > > > 2012/12/1 Raymond O'