Re: [SQL] transaction isolationa level - SERIALIZABLE

2013-05-13 Thread Marcin Krawczyk
That's what I thought. Thank you. regards mk 2013/5/13 Adrian Klaver > On 05/13/2013 02:22 AM, Marcin Krawczyk wrote: > >> Hi list, >> >> I have some problems with SERIALIZABLE isolation level, namely my users >> are plagued with concurrency errors. As of

[SQL] transaction isolationa level - SERIALIZABLE

2013-05-13 Thread Marcin Krawczyk
Hi list, I have some problems with SERIALIZABLE isolation level, namely my users are plagued with concurrency errors. As of postgres 9.1 (which I'm running) there has been a change to SERIALIZABLE logic, unfortunately my application has not been updated to work with the new logic. I don't have an

Re: [SQL] ALTER USER abc PASSWORD - what's going on ???

2013-04-19 Thread Marcin Krawczyk
Ok, thank you. pozdrowienia mk 2013/4/18 Guillaume Lelarge > On Thu, 2013-04-18 at 13:21 +0200, Marcin Krawczyk wrote: > > I figured it out... when changing role from pgAdmin, it has a default > VALID > > UNTIL 1970 set and after confirming changes it just made my abc user &

Re: [SQL] ALTER USER abc PASSWORD - what's going on ???

2013-04-18 Thread Marcin Krawczyk
e way. pozdrowienia mk 2013/4/18 Marcin Krawczyk > Hi, > > I can't change the pass for my user. When I invoke ALTER USER abc PASSWORD > newpassword > it changes ok but then I can't login with my newpassword... > > It says authetication failed. > My pg_hba.conf has md5 e

[SQL] ALTER USER abc PASSWORD - what's going on ???

2013-04-18 Thread Marcin Krawczyk
Hi, I can't change the pass for my user. When I invoke ALTER USER abc PASSWORD newpassword it changes ok but then I can't login with my newpassword... It says authetication failed. My pg_hba.conf has md5 entry for the ip I connect from. It used to work ok, but I accidentaly changed the password f

Re: [SQL] locks problem

2012-11-27 Thread Marcin Krawczyk
Ok I figured it out. I had a prepared transaction holding the locks. The pg_prepared_xacts was helpful. 27-11-2012 10:27, "Marcin Krawczyk" napisał(a): > Hi list, > > I've got a locking problem which prevents me from doing some alters on my > tables. When I looked i

[SQL] locks problem

2012-11-27 Thread Marcin Krawczyk
Hi list, I've got a locking problem which prevents me from doing some alters on my tables. When I looked into pg_locks I saw a lot of entries (around 1000) with pid being NULL and almost all of them are AccessShare. Can anyone tell me what might those be and how do I get rid of them ?

Re: [SQL] regexp_replace behavior

2012-11-20 Thread Marcin Krawczyk
Yes that's exactly what I needed. Thanks a lot. pozdrowienia mk 2012/11/20 Alvaro Herrera > Marcin Krawczyk escribió: > > Hi list, > > > > I'm trying to use regexp_replace to get rid of all occurrences of > > certain sub strings from my string.

[SQL] regexp_replace behavior

2012-11-20 Thread Marcin Krawczyk
Hi list, I'm trying to use regexp_replace to get rid of all occurrences of certain sub strings from my string. What I'm doing is: SELECT regexp_replace('F0301 305-149-101-0 F0302 {x1} 12W47 0635H {tt}{POL23423423}', E'\{.+\}', '', 'g') so get rid of whatever is between { } along with these, but

Re: [SQL] custom_variable_classes in 9.1

2012-02-29 Thread Marcin Krawczyk
;unset' which is all I've been asking for. pozdrowienia mk 2012/2/29 Marcin Krawczyk > Hi list, > > I'm using some global variables through custom_variable_classes facility. > I've recently switched from 8.1 to 9.1 > and somewhere along the line the behavio

[SQL] custom_variable_classes in 9.1

2012-02-29 Thread Marcin Krawczyk
Hi list, I'm using some global variables through custom_variable_classes facility. I've recently switched from 8.1 to 9.1 and somewhere along the line the behavior of custom_variable_classes has changed - if the variable has not been set for a given session invoking it (SELECT current_setting('nam

Re: [SQL] Function definitions - batch update

2012-02-21 Thread Marcin Krawczyk
Thanks for the hints, I'll give it a try. pozdrowienia mk 2012/2/21 Tom Lane > Marcin Krawczyk writes: > > I've come across a situation when I need to add some constant code to all > > functions in my database. Does anyone know a way to batch update all > >

[SQL] Function definitions - batch update

2012-02-20 Thread Marcin Krawczyk
Hi list, I've come across a situation when I need to add some constant code to all functions in my database. Does anyone know a way to batch update all definitions ? I've got like 500 functions so doing it one by one will be time consuming. pozdrowienia mk

Re: [SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Thanks, it working. pozdrowienia mk 2010/12/8 Marc Mamin > something like ? > > > > Select min (case when X > 0 then X end) > > > > > > HTH, > > > > Marc Mamin > > > > *From:* pgsql-sql-ow...@postgresql.org [mailto: > pgsql-s

Re: [SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Yeah I know but I'm having problems creating sfunc fuction for the aggregate. regards mk 2010/12/8 Pavel Stehule > Hello > > use a CASE statement > > http://www.postgresql.org/docs/7.4/static/functions-conditional.html > > Regards > > Pavel Stehule > > 2

[SQL] conditional aggregates

2010-12-08 Thread Marcin Krawczyk
Hi list, Can anyone advise me on creating an aggregate that would take additional parameter as a condition ? For example, say I have a table like this id;value 1;45 2;13 3;0 4;90 I'd like to do something like this SELECT min_some_cond_aggregate(value,0) FROM table to get the minimal value from

Re: [SQL] help

2010-06-27 Thread Marcin Krawczyk
Or even simpler, or easier to understand: SELECT trim(foo, '()') FROM foobar pozdrowienia / regards / salutations mk 2010/5/5 Nicholas I > Hi, > > I have a table in which the data's are entered like, > > Example: > > One (1) > Two (2) > Three (3) > > I want to extract the data which is only

Re: [SQL] pgAgent stats

2010-03-17 Thread Marcin Krawczyk
Thanks for your help guys. regards mk 2010/3/17 Dave Page > On Wed, Mar 17, 2010 at 12:24 PM, Marcin Krawczyk > wrote: > > Ha, it worked :)) kind of funny though. It was set to 0 but it's supposed > to > > not limit anything when 0 :)) a bug ? > > What

Re: [SQL] pgAgent stats

2010-03-17 Thread Marcin Krawczyk
Yeah... my bad. Sorry for being a pain in the a... ;) pozdrowienia mk 2010/3/17 Dave Page > On Wed, Mar 17, 2010 at 12:24 PM, Marcin Krawczyk > wrote: > > Ha, it worked :)) kind of funny though. It was set to 0 but it's supposed > to > > not limit anything when 0

Re: [SQL] pgAgent stats

2010-03-17 Thread Marcin Krawczyk
Ha, it worked :)) kind of funny though. It was set to 0 but it's supposed to not limit anything when 0 :)) a bug ? pozdrowienia / regards / salutations mk 2010/3/17 Dave Page > On Wed, Mar 17, 2010 at 12:15 PM, Marcin Krawczyk > wrote: > > It's pgAdmin 1.10.0. I'

Re: [SQL] pgAgent stats

2010-03-17 Thread Marcin Krawczyk
plog WHERE jsljstid = 5 ORDER BY jslstart DESC LIMIT 0 obviously the problem is LIMIT 0 clause but why it is there remains a mystery... pgAdmin bug ? a configuration issue ? regards mk 2010/3/17 Guillaume Lelarge > Hi, > > Le 16/03/2010 08:40, Marcin Krawczyk a écrit : > > Hi l

[SQL] pgAgent stats

2010-03-16 Thread Marcin Krawczyk
Hi list, does anyone know the reason for pgAdmin not showing the stats neither for selected pgAgent step nor whole job ? The pga_joblog and pga_jobsteplog both get populated with data on run so I was thinking that maybe I'm missing some view associated with statistics tabs ?? Any ideas ? regards

Re: [SQL] Trapping 'invalid input syntax for integer'

2009-09-10 Thread Marcin Krawczyk
Hi, I believe you're looking for invalid_text_representation. EXCEPTION WHEN invalid_text_representation THEN regards mk 2009/9/10 Mario Splivalo > Is there a way to trap this error in plpgsql code? > > I have a function that accepts integer and character varying. Inside > that function I nee

Re: [SQL] skip if latter value equal

2009-07-10 Thread Marcin Krawczyk
s.d then result.d := r.d else result.d > := NULL end if; > return next result; >end if; >s := r; > end loop; > return; > end; > $$ language plpgsql; > > select * from foo(); > > regards > Pavel Stehule > > 2009/7/10 Marcin Krawczyk :

[SQL] skip if latter value equal

2009-07-10 Thread Marcin Krawczyk
Hi list, I was wondering if it was possible for a field in SQL query to return NULL if latter value is exactly the same ? - for given ORDER BY clause, I guess. For example, query returns: xxyy 1 4 true xxyy 5 7 true xxyy 21 8 true yyzz 5 1 false yyzz 7 7 false yyzz 8 34 false I'd

Re: [SQL] cast bool/int

2009-03-23 Thread Marcin Krawczyk
This: SELECT true::integer, false::integer also works on 8.1 -- regards mk 2009/3/23 Achilleas Mantzios > Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε: > > > > Hi, > > I need a casting operator from boolean to integer, > > tu put in ALTER TABLE statment after USING. > > > > S

Re: [SQL] array variables

2008-11-13 Thread Marcin Krawczyk
Thank you guys, I appreciate your help. regards mk

Re: [SQL] array variables

2008-11-13 Thread Marcin Krawczyk
I know I can do one column like this : a := ARRAY(SELECT id FROM idx); but how about more than one ? Because if I try this : a := ARRAY(SELECT id, p FROM idx); I get ERROR: subquery must return only one column SQL state: 42601 regards mk

[SQL] array variables

2008-11-13 Thread Marcin Krawczyk
Hi all. Can anyone help me solve this problem ? Say I have something like this: CREATE TEMP TABLE idx (id integer, p integer, idd integer); INSERT INTO idx (id, p, idd) VALUES (3048, 1, 12043); INSERT INTO idx (id, p, idd) VALUES (3048, 2, 2321); INSERT INTO idx (id, p, idd) VALUES (3048, 5, 12002

[SQL] trigger parameters, what am I doing wrong ??

2008-10-09 Thread Marcin Krawczyk
Hi guys. I'm trying to pass a parameter to trigger procedure but it's not working and I have no idea why since it looks pretty ok. Here's what I do : CREATE OR REPLACE FUNCTION test_proc() RETURNS "trigger" AS $BODY$ DECLARE chk boolean; parinteger := TG_ARGV[0]; BEGIN RAISE NOTICE 'TG_

Re: [SQL] return setof record - strange behavior

2008-08-04 Thread Marcin Krawczyk
Dzieki za odpowiedz. Ciekawe ze funkcja SQL dziala bez problemu - ale tu juz trzeba wskazac parametry OUT. Thanks for your answer. It's curious that SQL function works as expected - but requires OUT params. pozdrowienia/regards mk 2008/8/4 Pawel Socha <[EMAIL PROTECTED]>: > >

[SQL] return setof record - strange behavior

2008-08-04 Thread Marcin Krawczyk
The function behaves as expected when in plain SQL, only plpgsql function has the above mentioned problem. regards mk -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] return setof record - strange behavior

2008-08-04 Thread Marcin Krawczyk
Hi everybody. Can anyone enlighten me what's wrong with this function : CREATE OR REPLACE FUNCTION month_year(mon integer, intv integer, OUT ro integer, OUT mi integer) RETURNS SETOF record AS $BODY$ DECLARE w record; cy integer := EXTRACT (YEAR FROM current_date); BEGIN FOR w IN

Re: [SQL] regexp_replace

2008-08-01 Thread Marcin Krawczyk
thanks / dzieki regards / pozdrowienia mk 2008/8/1 Pawel Socha <[EMAIL PROTECTED]>: > 2008/8/1 Marcin Krawczyk <[EMAIL PROTECTED]> >> >> Hi all. I'd like to know whether it's possible to reverse the >> behaviour of regexp_replace, meaning : >>

[SQL] regexp_replace

2008-08-01 Thread Marcin Krawczyk
Hi all. I'd like to know whether it's possible to reverse the behaviour of regexp_replace, meaning : now if I do SELECT regexp_replace ('foobarbaz', 'b..', 'X') I get 'fooXbaz' - it replaces the string that matches given pattern with 'X', how do I achieve the opposite - replace the string that does

Re: [SQL] record type

2008-07-11 Thread Marcin Krawczyk
Nice thanks a lot. Niezłe, dzieki. regards pozdrowienia mk 2008/7/11 Pawel Socha <[EMAIL PROTECTED]>: > > > 2008/7/10 Marcin Krawczyk <[EMAIL PROTECTED]>: > > Hi. I need to know whether it's possible for a plpgsql function to accept >> record type paramete

[SQL] record type

2008-07-10 Thread Marcin Krawczyk
Or maybe anyone knows how to work with record types ? How to insert something like ('1','2','3') into a table, or split it ? Anything ? regards mk

[SQL] record type

2008-07-10 Thread Marcin Krawczyk
Hi. I need to know whether it's possible for a plpgsql function to accept record type parameters ? Is there a way to accomplish that ? I need to use something like ('1','2','3') as a parameter. regards mk

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Thank you guys. Alvaro your idea works tha way I wanted. Why didn't I think about it ? :) regards mk

[SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Hi all. Can anyone tell me if there's a way to use CONTINUE clause outside the loop ? An example : FOR a IN SELECT * FROM xxx LOOP INSERT INTO yyy VALUES (a.***, ..) END LOOP; EXCEPTION WHEN unique_violation THEN CONTINUE; I get an error saying I can't use CONTINUE outside of a loop. Is there

Re: [SQL] triggers order

2008-04-18 Thread Marcin Krawczyk
Thanks for a fast answer. Frankly I was hoping it would be alphabetical ;) regards mk 2008/4/18, A. Kretschmer <[EMAIL PROTECTED]>: > > am Fri, dem 18.04.2008, um 11:44:12 +0200 mailte Marcin Krawczyk > folgendes: > > > Hi all. Today my question is about the order

[SQL] triggers order

2008-04-18 Thread Marcin Krawczyk
Hi all. Today my question is about the order triggers are fired on a table. Is there a way to determine that order? Or what interests me even more, can I adjust the order triggers are fired? Regards mk

[SQL] error codes

2008-04-17 Thread Marcin Krawczyk
Hi guys. Does anyone know the error code for '*currval of sequence * is not yet defined in this session*' error ? Is there one at all? I am aware of *others *code but I'd like to avoid using that. Thanks in advance. Regards mk

Re: [SQL] connections between servers

2008-04-03 Thread Marcin Krawczyk
Thanks a lot, I'll give it a try. regards mk 2008/4/3, Shane Ambler <[EMAIL PROTECTED]>: > > Marcin Krawczyk wrote: > > > Hi all. I was wondering if it's possible for a trigger to perform > > operations > > on a database on different server?

[SQL] connections between servers

2008-04-03 Thread Marcin Krawczyk
Hi all. I was wondering if it's possible for a trigger to perform operations on a database on different server? I saw somewhere that there's a piece of software that allows conneciotns between different databases, but what about different servers? I also thought about using perl, would it be possib

Re: [SQL] aggregate reverse

2008-02-02 Thread Marcin Krawczyk
Yes, you got me well. That's exactly what I was trying to achieve. Thank you. 2008/2/1, Pavel Stehule <[EMAIL PROTECTED]>: > > Hello > > I am not sure if I understand well. > > On 01/02/2008, Marcin Krawczyk <[EMAIL PROTECTED]> wrote: > > Hi all. I wol

[SQL] aggregate reverse

2008-02-01 Thread Marcin Krawczyk
Hi all. I wolud like to know whether it is possible to reverse the behaviour of an aggregate? Say I have a string '1,2,3,4'. Is there a way to split those values to records? Regards and thanks in advance. mk

Re: [SQL] age() function usage

2008-01-25 Thread Marcin Krawczyk
Heh, that was easy, I must have been working for too long... :) Thanks 2008/1/25, Scott Marlowe <[EMAIL PROTECTED]>: > > On Jan 25, 2008 1:06 PM, Marcin Krawczyk <[EMAIL PROTECTED]> wrote: > > Hi all. I am trying to determine the way to pass a variable/field value &g

[SQL] age() function usage

2008-01-25 Thread Marcin Krawczyk
Hi all. I am trying to determine the way to pass a variable/field value to an age() function, query looks something like: SELECT age(timestamp data_zakonczenia_fakt) FROM kip_pracownicy_umowy WHERE id_pracownika = 8 data_zakonczenia_fakt being char column equal to say '1993-11-30'. Such approach

Re: [SQL] table column names - search

2008-01-14 Thread Marcin Krawczyk
Thanks a lot. 2008/1/14, Peter Eisentraut <[EMAIL PROTECTED]>: > > Am Montag, 14. Januar 2008 schrieb Marcin Krawczyk: > > Hi all. I would like to know if there's a way to obtain a list of tables > > containing specified column name? Using standard LIKE '

[SQL] table column names - search

2008-01-14 Thread Marcin Krawczyk
Hi all. I would like to know if there's a way to obtain a list of tables containing specified column name? Using standard LIKE '%string' syntax would be great. Regards, mk

Re: [SQL] temp table existence

2007-12-29 Thread Marcin Krawczyk
I just realized something... my bad. It will work since TRUNCATE removes only table from current session. Thank you again. Regards

Re: [SQL] temp table existence

2007-12-29 Thread Marcin Krawczyk
xx will be truncated, which I would not like to happen since since they may still be in use. 2007/12/29, Marcin Krawczyk <[EMAIL PROTECTED]>: > > Hi all. Is there a way to determine the existence of a TEMP > TABLE? I need to check i it exists before I create it. Doing simple check

[SQL] temp table existence

2007-12-29 Thread Marcin Krawczyk
Hi all. Is there a way to determine the existence of a TEMP TABLE? I need to check i it exists before I create it. Doing simple check on pg_class or pg_tables is not enough because there may be other such tables created in other sessions. Or maybe anyone knows the identification (apart from 'others

[SQL] raise exception and transaction handling

2007-07-28 Thread Marcin Krawczyk
Hi, I have a problem with transaction handling. What I need to do is execute an INSERT command that would not be canceled by the RAISE EXCEPTION command in AFTER UPDATE TRIGGER. A piece of code: BEGIN -- some computations bledne := (SELECT g.q_sumka('Poz.' || lps || ' - min. cena: ' || cena || '