Re: [GENERAL] Justifying a PG over MySQL approach to a project

2009-12-19 Thread Lincoln Yeoh
At 03:19 AM 12/19/2009, David Boreham wrote: Lincoln Yeoh wrote: It seems you currently can only control outbound traffic from an interface, so you'd have to set stuff on both interfaces to shape upstream and downstream - this is not so convenient in some network topologies. This is more a

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Filip Rembiałkowski
Tsung [http://tsung.erlang-projects.org/] has a nice pg proxy module. It records your query stream and is able to replay it later. 2009/12/18 Chris Ernst cer...@esoft.com Hi all, I have a project where I need to be able to capture every query from a production system into a file such that

Re: [GENERAL] defining yuor own commands in PG ?

2009-12-19 Thread Filip Rembiałkowski
2009/12/18 Gauthier, Dave dave.gauth...@intel.com Can you define your own commands in PG. In psql, yes: \set sel 'SELECT * FROM' :sel clients; \set desc '\\d' :desc table E.g., if users from other DBs use “describe foo” to get the metadata for foo, is there a way I can create a command

[GENERAL] AccessShareLock question

2009-12-19 Thread Clayton Graf
I get an AccessShareLock in a simple select command and I am not using the FOR SHARE clause. The select is just select * from controle. The connection is JDBC and the driver is postgresql-8.4-701.jar. What am I doing wrong? This is the code: Class.forName(jdbc).newInstance();

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Chris Ernst
Greg Smith wrote: Chris Ernst wrote: I started writing my own log parser to pull the statements from the postgres logs, but as I get in to the details, it's not quite as straight forward as I had thought. Keeping track of which client connections have prepared queries, merging the correct

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Merlin Moncure
On Sat, Dec 19, 2009 at 1:05 AM, Postgres User postgres.develo...@gmail.com wrote: BEGIN SELECT array_agg(category_id) INTO cat_list FROM (         WITH RECURSIVE subcategory AS                (                SELECT * FROM category                WHERE category_id = p_category_id        

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Chris Ernst
Hmm.. That does look very interesting. The only thing that concerns me is where it says it supports Basic Queries (Extended queries not yet supported). I'm not sure what is meant by Extended queries. Any idea? Thank you for the pointer, Filip. I'll check it out. - Chris Filip

Re: [GENERAL] AccessShareLock question

2009-12-19 Thread Jaime Casanova
On Sat, Dec 19, 2009 at 9:04 AM, Clayton Graf clayton.g...@gmail.com wrote: I get an AccessShareLock in a simple select command and I am not using the FOR SHARE clause. http://www.postgresql.org/docs/current/static/explicit-locking.html says: ACCESS SHARE Conflicts with the ACCESS

Re: [GENERAL] AccessShareLock question

2009-12-19 Thread Clayton Graf
Ok, but this is really my problem: I cannot perform an ALTER TABLE with the system in production mode, because the ALTER TABLE hangs due an AccessShareLock. We use two-tier mode, so is it necessary to shutdown all users before perform an ALTER TABLE? Is it this true? Thanks, Clayton 2009/12/19

Re: [GENERAL] AccessShareLock question

2009-12-19 Thread Jaime Casanova
On Sat, Dec 19, 2009 at 10:58 AM, Clayton Graf clayton.g...@gmail.com wrote: Ok, but this is really my problem: I cannot perform an ALTER TABLE with the system in production mode, because the ALTER TABLE hangs due an AccessShareLock. until the lock is released, are your selects all that long?

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Postgres User
On Sat, Dec 19, 2009 at 6:56 AM, Merlin Moncure mmonc...@gmail.com wrote: On Sat, Dec 19, 2009 at 1:05 AM, Postgres User postgres.develo...@gmail.com wrote: BEGIN SELECT array_agg(category_id) INTO cat_list FROM (         WITH RECURSIVE subcategory AS                (                SELECT

[GENERAL] How to call a function that returns a refcursor ?

2009-12-19 Thread Postgres User
Hi, I have a function that returns a refcursor that I need to call from a second function. In the second function, I'd like to read a column value from each row. However, I'm having a problem accessing the rows of the refcursor. Can anyone point me to a working example of how to pull this off?

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Merlin Moncure
On Sat, Dec 19, 2009 at 1:30 PM, Postgres User postgres.develo...@gmail.com wrote: Thanks, your syntax does compile and run. This is where it gets interesting.  With your syntax (and variations of it), I'm able to successfully compile and execute.  However, as soon as I add a dozen rows to

[GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Andrus
How to use column values set in update in subsequent set clauses and in subqueries in subsequent row updates? I tried set transaction isolation level read uncommitted; create temp table test1 ( a int, b int) on commit drop; insert into test1 values(1,2); update test1 set a=4, b=a ; select *

[GENERAL] modelling question

2009-12-19 Thread Garry Saddington
Anyone have any ideas/suggestions on how to model siblings in a database so that it is possible to eg. only send letters to the parents once. In this scenario each sibling has the contact parents input separately (secretarial input!). Garry -- Sent via pgsql-general mailing list

Re: [GENERAL] Triggers made with plpythonu performance issue

2009-12-19 Thread Adrian Klaver
On Friday 18 December 2009 11:00:33 am sabrina miller wrote: Hi everybody, My requirements was: + Made a table charge to be partitioned by carrier and month + summarize by charges + summarize by users, + each summarization must be by month and several others columns. Doesn't sound

Re: [GENERAL] AccessShareLock question

2009-12-19 Thread Clayton Graf
I think I got it... I was just using select * from table1; select * from table2; select * from tablen; instead of begin; select * from table1; select * from table2; select * from tablen; commit; Using MS-SQLSERVER the begin trans is implicit at first update or delete command. It is not

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-19 Thread Adrian Klaver
On Friday 18 December 2009 4:30:46 am Durumdara wrote: Hi! I have a software that uses Postgresql. This program (and website) developed and working on Window (XP/2003), with native charset (win1250). Prior week we got a special request to install this software to a Linux server. Yesterday

Re: [GENERAL] AccessShareLock question

2009-12-19 Thread Adrian Klaver
On Saturday 19 December 2009 12:45:15 pm Clayton Graf wrote: I think I got it... I was just using select * from table1; select * from table2; select * from tablen; instead of begin; select * from table1; select * from table2; select * from tablen; commit; Using MS-SQLSERVER the

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-19 Thread Dave Page
On Sat, Dec 19, 2009 at 8:54 PM, Adrian Klaver akla...@comcast.net wrote: The Windows version of PG and Admin is not supports collation, so these two options are disable (collation, character type). There is a Linux version of PGAdmin available for Ubuntu 9.10. Doesn't matter - pgAdmin

Re: [GENERAL] alter table performance

2009-12-19 Thread Antonio Goméz Soto
Hi, is there a way in sql to dynamically test for version 7.3, so I can run the alter table add column update table set column = .. where column IS NULL; alter table alter column set not null on 7.3, and on newer versions: alter table add column ... not null default ''; Maybe I can

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-19 Thread Adrian Klaver
On Saturday 19 December 2009 1:04:30 pm Dave Page wrote: On Sat, Dec 19, 2009 at 8:54 PM, Adrian Klaver akla...@comcast.net wrote: The Windows version of PG and Admin is not supports collation, so these two options are disable (collation, character type). There is a Linux version of

Re: [GENERAL] alter table performance

2009-12-19 Thread Jaime Casanova
On Sat, Dec 19, 2009 at 4:07 PM, Antonio Goméz Soto antonio.gomez.s...@gmail.com wrote: Hi, is there a way in sql to dynamically test for version 7.3, so I can run the are you planning to run this many times? what is wrong with making this manually? doesn't seem like something to make

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Jaime Casanova
2009/12/19 Andrus kobrule...@hot.ee: set transaction isolation level read uncommitted; the isolation level is for specifying what rows are visible no for columns. besides, postgres doesn't implement read uncommitted update test1 set a=4, b=a ; b value is 1 but must be 4. no. b value must

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Christophe Pettus
On Dec 19, 2009, at 11:24 AM, Andrus wrote: set transaction isolation level read uncommitted; create temp table test1 ( a int, b int) on commit drop; insert into test1 values(1,2); update test1 set a=4, b=a ; select * from test1 b value is 1 but must be 4. How to use updated value ? The

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Tom Lane
Christophe Pettus x...@thebuild.com writes: On Dec 19, 2009, at 11:24 AM, Andrus wrote: update test1 set a=4, b=a ; How to use updated value ? The problem here isn't the transaction isolation level. The order of evaluation in an UPDATE statement is (for practical purposes): Evaluate

Re: [GENERAL] How to call a function that returns a refcursor ?

2009-12-19 Thread Pavel Stehule
2009/12/19 Postgres User postgres.develo...@gmail.com: Hi, I have a function that returns a refcursor that I need to call from a second function.  In the second function, I'd like to read a column value from each row.  However, I'm having a problem accessing the rows of the refcursor. Can

Re: [GENERAL] Charset Win1250 on Windows and Ubuntu

2009-12-19 Thread Albe Laurenz
Durumdara wrote: I have a software that uses Postgresql. This program (and website) developed and working on Window (XP/2003), with native charset (win1250). Prior week we got a special request to install this software to a Linux server. Yesterday I installed Ubu9.10 on VirtualBox, and

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Albe Laurenz
Chris Ernst wrote: I have a project where I need to be able to capture every query from a production system into a file such that I can replay them on a staging system. Does such a thing already exist or should I start writing my own log parser? I am currently developing such a beast, it is

Re: [GENERAL] Extracting SQL from logs in a usable format

2009-12-19 Thread Shoaib Mir
On Sun, Dec 20, 2009 at 9:37 AM, Albe Laurenz laurenz.a...@wien.gv.atwrote: Chris Ernst wrote: I have a project where I need to be able to capture every query from a production system into a file such that I can replay them on a staging system. Does such a thing already exist or should I

[GENERAL] How to find string intersection

2009-12-19 Thread Andrus
Function parameter named classes contains 1..4 (can be more if this simplifies solution) uppercase characters or digits. It checks for those character presence in summak.klass column ( this column type is CHAR(10) ) To solve this I created function below but this requires always 4 characters to

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Andrus
I would be quite surprised if there are any SQL databases that do this differently. FoxPro's and probably dBase's do it differently. CREATE CURSOR t ( a i, b i ) INSERT INTO t VALUES (1,2) UPDATE t SET a=3, b=a SELECT * FROM t returns 3 for b Andrus. -- Sent via pgsql-general mailing list

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Andrus
Christophe, It's not clear why you need to do it this way, though. Presumably, since you did some kind of computation that came up with the number '4', you can assign that value instead of using the field a: UPDATE test1 set a=4, b=4; There are two reasons: 1. In my case b expression

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Postgres User
Great call, someone did hose the data. Oddly enough the circular reference caused no problem when running the stand alone recursive SQL (with clause). On Sat, Dec 19, 2009 at 10:41 AM, Merlin Moncure mmonc...@gmail.com wrote: On Sat, Dec 19, 2009 at 1:30 PM, Postgres User

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Christophe Pettus
On Dec 19, 2009, at 3:34 PM, Andrus wrote: FoxPro's and probably dBase's do it differently. Of course, FoxPro and related are not actually relational databases; they're flat-file managers which use comamnds which somewhat resemble the SQL syntax. -- -- Christophe Pettus

Re: [GENERAL] How to use read uncommitted transaction level and set update order

2009-12-19 Thread Christophe Pettus
On Dec 19, 2009, at 4:06 PM, Andrus wrote: 1. In my case b expression needs values from previous rows updated in this same command before: b= (select sum(a) from test1 where select_test1_previously_updated_rows_condition ) I believe there is a misunderstanding as to what read committed

Re: [GENERAL] modelling question

2009-12-19 Thread Jeff Davis
On Sat, 2009-12-19 at 20:36 +, Garry Saddington wrote: Anyone have any ideas/suggestions on how to model siblings in a database so that it is possible to eg. only send letters to the parents once. In this scenario each sibling has the contact parents input separately (secretarial

Re: [GENERAL] defining yuor own commands in PG ?

2009-12-19 Thread Gauthier, Dave
THere's nothing wrong with \d. I prefer it. I really like \? to get all the '\' commands. It's a great system. But I'm in a position of having to calm potential MySQL users who are nervous about different commands. I think once they get to know the '\' commands, they'll be fine. But for