Re: [SQL] ignore unique violation OR check row exists

2012-01-04 Thread Zdravko Balorda
Andreas Kretschmer wrote: rverghese ri...@hotmail.com wrote: I want to insert a bunch of records and not do anything if the record already exists. So the 2 options I considered are 1) check if row exists or insert and 2) ignore the unique violation on insert if row exists. Any opinions on

[SQL] inheritance

2010-03-17 Thread Zdravko Balorda
Hi, I am new to postgress inheritance. Once a parent row is inserted can I later reconnect child rows so that thay get adopted by parent row? Regards, Zdravko. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription:

[SQL] PHP pg_escape_string

2009-06-15 Thread Zdravko Balorda
Hi, I have a PHP/PGSQL question: there are both pg_(un)escape_bytea() functions but only one pg_escape_string()... I wonder if I may be missing something here? Thank you for any explanation, Zdravko. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your

[SQL] Alter Table/Indexing

2009-03-24 Thread Zdravko Balorda
Hi, I wonder does ATER TABLE TYPE, SET, depends on indexes, like INSERT does in a sense it may be faster to drop and recreate index than sorting after every row inserted. Does changing type or setting default on an indexed column require sorting? Thanks, Zdravko -- Sent via pgsql-sql

[SQL] cast bool/int

2009-03-23 Thread Zdravko Balorda
Hi, I need a casting operator from boolean to integer, tu put in ALTER TABLE statment after USING. Any ideas? Thanks. Zdravko -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] cast bool/int

2009-03-23 Thread Zdravko Balorda
CASE WHEN column='t' THEN 1 ELSE 0 END Or just CASE WHEN column THEN 1 ELSE 0 END. In the mean time I've got an elegant solution: alter ... ... column TYPE smallint USING column::boolean::int::smallint; It works, you wouldn't beleive it. ;) Zdravko -- Sent via pgsql-sql mailing list

[SQL] alter table on a large db

2009-03-19 Thread Zdravko Balorda
Hi, I need to make some ALTER TABLEs. It takes about 30min to copy this quite large databse, bat several ours to run a bunch of ALTER TABLE statements. Is there any way to make it faster? I wonder what could possibly alter table be doing all this time. Regards, Zdravko. -- Sent via