Re: [GENERAL] Cleaning up a text import

2013-06-28 Thread Adrian Klaver
On 06/28/2013 09:36 AM, Bob Pawley wrote: Hi I imported some text using the Quantum GIS dxf2postgiswhich somehow became distorted through the import. What should have been imported was TK-208. What I got was %%UTK-208%%U. Perhaps I did something wrong while using dxf2postgis? Otherwise, I ca

Re: [GENERAL] Postgres case insensitive searches

2013-06-28 Thread John R Pierce
On 6/28/2013 6:59 PM, bhanu udaya wrote: select * from table where type like 'ab%'. It should get all above 3 records. Is there a way the database itself can be made case-insensitive with UTF8 characterset. I tried with character type & collation POSIX, but it did not really help. use ILIKE

Re: [GENERAL] Postgres case insensitive searches

2013-06-28 Thread bhanu udaya
Thanks. But, I do not want to convert into upper and show the result. Example, if I have records as below: id type 1. abcd 2. Abcdef 3. ABcdefg 4. aaadf The below query should report all the above select * from table where type like 'ab%'. It should get all above 3 records. Is there a way

Re: [GENERAL] How to REMOVE an "on delete cascade"?

2013-06-28 Thread Richard Broersma
You can do all that in a single sql command. ALTER TABLE b DROP CONSTRAINT b_a_id_fkey, ADD CONSTRAINT b_a_id FOREIGN KEY (a_id) REFERENCES a(a_id); On Fri, Jun 28, 2013 at 5:55 AM, Albe Laurenz wrote: > Phoenix Kiula wrote: > > Hi. Hard to find this command in the documentation - how should I

Re: [GENERAL] Application locking

2013-06-28 Thread Kenneth Tilton
Sorry, big typo below: On Fri, Jun 28, 2013 at 1:16 PM, Kenneth Tilton wrote: > We want to make sure no two examiners are working on the same case at the > same time, where the cases are found by searching on certain criteria with > limit 1 to get the "next case". > > A naive approach would be

[GENERAL] Application locking

2013-06-28 Thread Kenneth Tilton
We want to make sure no two examiners are working on the same case at the same time, where the cases are found by searching on certain criteria with limit 1 to get the "next case". A naive approach would be (in a stored procedure): next_case_id := null; select id into next_case_id from c

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread Simon Riggs
On 28 June 2013 17:17, Tom Lane wrote: > Simon Riggs writes: > > We claim conformance to the standard on this. > > Not really. The fact that we do RI actions via triggers is already not > what the spec envisions. As an example, it's well known that you can > subvert RI actions entirely by inst

[GENERAL] Cleaning up a text import

2013-06-28 Thread Bob Pawley
Hi I imported some text using the Quantum GIS dxf2postgiswhich somehow became distorted through the import. What should have been imported was TK-208. What I got was %%UTK-208%%U. Perhaps I did something wrong while using dxf2postgis? Otherwise, I can trim the text using - select trim (both

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread Tom Lane
Simon Riggs writes: > We claim conformance to the standard on this. Not really. The fact that we do RI actions via triggers is already not what the spec envisions. As an example, it's well known that you can subvert RI actions entirely by installing triggers on the target table that make the RI

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread Simon Riggs
On 28 June 2013 16:09, David Greco wrote: > Yes, renaming the trigger does in fact work. Any thoughts on the theory of > this behavior? i.e. is this ANSI compliant? Or should there be a mechanism > in place that guarantees the FK-enforcement trigger runs after all others? > Hmm, it doesn't conf

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread David Greco
-Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Friday, June 28, 2013 10:10 AM To: David Greco Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] AFTER triggers and constraints David Greco writes: > Since the trigger is defined as AFTER ROW, versus AFTER STATEMEN

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread Tom Lane
David Greco writes: > Since the trigger is defined as AFTER ROW, versus AFTER STATEMENT, I believe > the trigger should be considered part of the statement, therefore the > constraint should not be checked until after the row triggers have run. Any > thoughts? Not sure that this is terribly we

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread David Greco
From: Vick Khera [mailto:vi...@khera.org] Sent: Friday, June 28, 2013 9:35 AM To: David Greco Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] AFTER triggers and constraints On Fri, Jun 28, 2013 at 8:45 AM, David Greco mailto:david_gr...@harte-hanks.com>> wrote: The last delete statement

Re: [GENERAL] AFTER triggers and constraints

2013-06-28 Thread Vick Khera
On Fri, Jun 28, 2013 at 8:45 AM, David Greco wrote: > The last delete statement will throw a referential integrity error. In > Oracle, same example, it does not as the trigger deletes the child. > > Not sure your real case, but why not just make the FK on delete cascade and get rid of your tri

Re: [GENERAL] Why are there no inequality scans for ctid?

2013-06-28 Thread Christoph Berg
Re: hubert depesz lubaczewski 2013-06-28 <20130628085246.ga25...@depesz.com> > On Fri, Jun 28, 2013 at 02:21:10PM +0530, Atri Sharma wrote: > > How would this be helpful for general use cases? Querying on tids on a > > specific page doesn't seem too useful for any other case than the one > > you me

Re: [GENERAL] How to REMOVE an "on delete cascade"?

2013-06-28 Thread Albe Laurenz
Phoenix Kiula wrote: > Hi. Hard to find this command in the documentation - how should I alter a > table to REMOVE the "on > delete cascade" constraint from a table? Thanks. Unless you want to mess with the catalogs directly, I believe that you have to create a new constraint and delete the old o

[GENERAL] AFTER triggers and constraints

2013-06-28 Thread David Greco
Came across an interesting situation as part of our Oracle to PostgreSQL migration. In Oracle, it appears that immediate constraints are checked after the entire statement is run, including any AFTER ROW triggers. In Postgres, they are applied before the AFTER ROW triggers. In some of our AFTER

Re: [GENERAL] Postgres case insensitive searches

2013-06-28 Thread Albe Laurenz
bhanu udaya wrote: > What is the best way of doing case insensitive searches in postgres using > Like. Table "laurenz.t" Column | Type | Modifiers +-+--- id | integer | not null val| text| not null Indexes: "t_pkey" PRIMARY KEY, btree (id) CRE

[GENERAL] How to REMOVE an "on delete cascade"?

2013-06-28 Thread Phoenix Kiula
Hi. Hard to find this command in the documentation - how should I alter a table to REMOVE the "on delete cascade" constraint from a table? Thanks.

Re: [GENERAL] auto_explain & FDW

2013-06-28 Thread David Greco
>-Original Message- >From: Albe Laurenz [mailto:laurenz.a...@wien.gv.at] >Sent: Friday, June 28, 2013 4:05 AM >To: David Greco; pgsql-general@postgresql.org >Subject: RE: auto_explain & FDW >David Greco wrote: >> In my development environment, I am using the auto_explain module to >> hel

[GENERAL] Postgres case insensitive searches

2013-06-28 Thread bhanu udaya
Hello, Grettings, What is the best way of doing case insensitive searches in postgres using Like. Ilike - does not use indexes function based indexes are not as fast as required. CITEXT - it still taking 600 ms - 1 second on a 2.2 million rows... does not use index Collation Indexes creatio

Re: [GENERAL] utf8 errors

2013-06-28 Thread Vincent Veyron
Le vendredi 28 juin 2013 à 08:15 +0200, Pavel Stehule a écrit : > there is a same issues in perl dbi driver with UTF8 strings - it does > some artificial intelligence and try to do some utf transformations. > Hi Pavel, I glanced over it, but dismissed it as the problem also appeared in my ssh s

Re: [GENERAL] Why are there no inequality scans for ctid?

2013-06-28 Thread hubert depesz lubaczewski
On Fri, Jun 28, 2013 at 02:21:10PM +0530, Atri Sharma wrote: > How would this be helpful for general use cases? Querying on tids on a > specific page doesn't seem too useful for any other case than the one > you mentioned above, and IMHO it seems to be the job of vacuum. > I may be missing somethin

Re: [GENERAL] Why are there no inequality scans for ctid?

2013-06-28 Thread Atri Sharma
On Fri, Jun 28, 2013 at 2:07 PM, hubert depesz lubaczewski wrote: > Hi, > while working on removing bloat from some table, I had to use ltos of > logic simply because there are no (idnexable) inequality scans for > ctids. > > Is it because just noone thought about adding them, or are there some >

[GENERAL] Why are there no inequality scans for ctid?

2013-06-28 Thread hubert depesz lubaczewski
Hi, while working on removing bloat from some table, I had to use ltos of logic simply because there are no (idnexable) inequality scans for ctids. Is it because just noone thought about adding them, or are there some more fundamental issues? I could imagine that things like: select * from table

Re: [GENERAL] auto_explain & FDW

2013-06-28 Thread Albe Laurenz
David Greco wrote: > In my development environment, I am using the auto_explain module to help > debug queries the developers > complain about being slow. I am also using the oracle_fdw to perform queries > against some oracle > servers. These queries are generally very slow and the application a

Re: [GENERAL] utf8 errors

2013-06-28 Thread Jiří Pavlovský
On 28.6.2013 9:09, Alban Hertroys wrote: > On Jun 26, 2013, at 16:58, Alban Hertroys wrote: > >> On 26 June 2013 11:03, Jiří Pavlovský wrote: >> On 26.6.2013 10:58, Albe Laurenz wrote: >>> Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID

[GENERAL] Re: [HACKERS] Frontend/backend protocol improvements proposal (request).

2013-06-28 Thread Albe Laurenz
Dmitriy Igrishin wrote: >> Since there can be only one unnamed prepared statement per >> session, there should be only one such object per connection. >> It should not get deallocated; maybe it could be private to the >> connection, which only offers a "parseUnnamed" and "executeUnnamed" >> mathod.

Re: [GENERAL] utf8 errors

2013-06-28 Thread Alban Hertroys
On Jun 26, 2013, at 16:58, Alban Hertroys wrote: > On 26 June 2013 11:03, Jiří Pavlovský wrote: > On 26.6.2013 10:58, Albe Laurenz wrote: > > Jirí Pavlovský wrote: > >> I have a win32 application. > >> LOG: statement: INSERT INTO recipients (DealID, > >> Contactid)

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-28 Thread Albe Laurenz
>> But in the following expression: >> >> template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/0 END; >> ERROR: division by zero >> >> (Just to be sure, a "SELECT (SELECT 0)=0;" returns true) >> >> It seems that when the "CASE WHEN expression" is a query, the evaluation >> order changes. >> Acc