[GENERAL] GSL in mcbc(redhat)

2013-04-12 Thread Yuriy Rusinov
Hello, colleagues !

I have to develop some functions onto postgresql server 9.2 based on Gnu
Scientific Library. Under redhat I compile gsl with ./configure
--prefix=/usr/local compile postgresql with ./configure --prefix=/usr/local
--with-uuid-ossp --with-xml --with-xslt. After that I try to put our
functions with -lgsl and receive error libfloader.so cannot load
libgsl.so.0 file not found. Under gentoo or ubuntu all works fine. Any
ideas ?

-- 
Best regards,
Sincerely yours,
Yuriy Rusinov.


[GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi


Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a 
column with First names and need to list names that have non-alphanumeric 
characters in them like + or * and the list goes on.  I did google a bit and 
tried:
select * from TABLE where first_name not like '%[a-z0-9]%';

However the above shows all the entries in that column and if I change it to 
Like, which should show all the entries it shows nothing.

e.g of my goal:

Column
Bob
Jane+
Harry*
John
Mike
Larry

My query should output

Jane+
Harry*



To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread John R Pierce

On 4/11/2013 11:23 PM, Baboo, Isa wrote:


Firstly let me mention I am a noob to postgres,DB and sql anyway, I 
have a column with First names and need to list names that have 
non-alphanumeric characters in them like + or * and the list goes on.  
I did google a bit and tried:


/select * from TABLE where first_name not like '%[a-z0-9]%'; /



you'll probably have to use a regex for that.

something like...  (my regex is really rusty)

   ... WHERE first_name !~ '^[a-z0-9]*$';



--
john r pierce  37N 122W
somewhere on the middle of the left coast



Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

Thanks for the response but I tried that and it does not work here is an 
example of names which still display.

test
sadadds
Hillary
BEN NAME
ALAN MCGARVEY +


From: pgsql-general-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
Sent: 12 April 2013 08:41 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

On 4/11/2013 11:23 PM, Baboo, Isa wrote:
Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a 
column with First names and need to list names that have non-alphanumeric 
characters in them like + or * and the list goes on.  I did google a bit and 
tried:
select * from TABLE where first_name not like '%[a-z0-9]%';

you'll probably have to use a regex for that.

something like...  (my regex is really rusty)

   ... WHERE first_name !~ '^[a-z0-9]*$';





--

john r pierce  37N 122W

somewhere on the middle of the left coast

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Ian Lawrence Barwick
 From: pgsql-general-ow...@postgresql.org
 [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
 Sent: 12 April 2013 08:41 AM
 To: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] list non alphanumeric



 On 4/11/2013 11:23 PM, Baboo, Isa wrote:

 Firstly let me mention I am a noob to postgres,DB and sql anyway, I have a
 column with First names and need to list names that have non-alphanumeric
 characters in them like + or * and the list goes on.  I did google a bit and
 tried:

 select * from TABLE where first_name not like '%[a-z0-9]%';


 you'll probably have to use a regex for that.

 something like...  (my regex is really rusty)

... WHERE first_name !~ '^[a-z0-9]*$';

2013/4/12 Baboo, Isa iba...@fnb.co.za:

 Hi

 Thanks for the response but I tried that and it does not work here is an
 example of names which still display.

 test
 sadadds
 Hillary
 BEN NAME
 ALAN MCGARVEY +

Something like:

... WHERE first_name ~ '[^\w]'

might do the trick.

Regards

Ian Barwick


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread John R Pierce

On 4/11/2013 11:50 PM, Baboo, Isa wrote:


Thanks for the response but I tried that and it does not work here is 
an example of names which still display.


test

sadadds

Hillary

BEN NAME

ALAN MCGARVEY +



well, at least one of those has a space inline, you didn't say that was 
acceptable, just a-z0-9
and of course, upper and lower case, so you probably should use 
[A-Za-z0-9 ]  (note the space before the close bracket)





--
john r pierce  37N 122W
somewhere on the middle of the left coast



Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

It still displaying everything, maybe it is the spaces?


test
sadadds
Hillary
BEN NAME
BOB
/+
...skipping
 ALAN MCGARVEY +

-Original Message-
From: Ian Lawrence Barwick [mailto:barw...@gmail.com] 
Sent: 12 April 2013 09:08 AM
To: Baboo, Isa
Cc: John R Pierce; pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

 From: pgsql-general-ow...@postgresql.org
 [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
 Sent: 12 April 2013 08:41 AM
 To: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] list non alphanumeric



 On 4/11/2013 11:23 PM, Baboo, Isa wrote:

 Firstly let me mention I am a noob to postgres,DB and sql anyway, I 
 have a column with First names and need to list names that have 
 non-alphanumeric characters in them like + or * and the list goes on.  
 I did google a bit and
 tried:

 select * from TABLE where first_name not like '%[a-z0-9]%';


 you'll probably have to use a regex for that.

 something like...  (my regex is really rusty)

... WHERE first_name !~ '^[a-z0-9]*$';

2013/4/12 Baboo, Isa iba...@fnb.co.za:

 Hi

 Thanks for the response but I tried that and it does not work here is 
 an example of names which still display.

 test
 sadadds
 Hillary
 BEN NAME
 ALAN MCGARVEY +

Something like:

... WHERE first_name ~ '[^\w]'

might do the trick.

Regards

Ian Barwick

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] list non alphanumeric

2013-04-12 Thread Baboo, Isa
Hi

Sorry guys I should have mention spaces, I did but it was a bit late. Anyway 
that [A-Za-z0-9 ]  worked  thanks John.


From: pgsql-general-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
Sent: 12 April 2013 09:12 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] list non alphanumeric

On 4/11/2013 11:50 PM, Baboo, Isa wrote:
Thanks for the response but I tried that and it does not work here is an 
example of names which still display.

test
sadadds
Hillary
BEN NAME
ALAN MCGARVEY +

well, at least one of those has a space inline, you didn't say that was 
acceptable, just a-z0-9
and of course, upper and lower case, so you probably should use [A-Za-z0-9 ]  
(note the space before the close bracket)






--

john r pierce  37N 122W

somewhere on the middle of the left coast

To read FirstRand Bank's Disclaimer for this email click on the following 
address or copy into your Internet browser: 
https://www.fnb.co.za/disclaimer.html 

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclai...@fnb.co.za and we will send you a copy of the Disclaimer.


Re: [GENERAL] How to convert US date format to European date format ?

2013-04-12 Thread Condor

On 2013-04-10 22:35, Thomas Kellerer wrote:

John R Pierce wrote on 10.04.2013 21:28:

On 4/10/2013 6:15 AM, Thomas Kellerer wrote:

psql (one of the possible client applications) uses the datestyle
parameter to decide on how to format a date column when displaying
it.

If you change the datestyle parameter in postgresql.conf, it will
influence the way psql displays the date values. Probably pgAdmin
will also check that setting (as I don't use pgAdmin I can't really
tell).


PSQL doesn't use that, postgres itself does.   it can be set on the
fly with SET on a per-connection basis, or with ALTER DATABASE on a
per-database basis.



But the *display* is done by the client.
And if Postgres (the server) did the conversion, I would not be able
to see a different date formatting in e.g. a JDBC based tool. So I
guess psql is reading that database/server setting.



Hello again,
what parameter should I use to have date in format:

dd-mm- ? I try to use Posgtgres, DMY and it's seems is work,
but not in my case, because I have also a field:

last_date timestamp without time zone default 
('now'::text)::timestamp(6) with time zone


and ISO, DMY show me: 2012-10-15 11:00:49.397908 if I use Postgres, DMY 
show me

Mon 15 Oct 11:00:49.397908 2012

But I want to be formatted: 11:00:49 15-10-2012

Is this possible to be done ?

Cheers,
Hristo S.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to convert US date format to European date format ?

2013-04-12 Thread John R Pierce

On 4/12/2013 12:42 AM, Condor wrote:
and ISO, DMY show me: 2012-10-15 11:00:49.397908 if I use Postgres, 
DMY show me

Mon 15 Oct 11:00:49.397908 2012

But I want to be formatted: 11:00:49 15-10-2012 


use the date formatting functions, like...

select to_char(yourfield, 'HH:MI:SS DD-MM-') ...

see http://www.postgresql.org/docs/current/static/functions-formatting.html




--
john r pierce  37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Yang Zhang
Any hints with this question I had posted to SO?

http://stackoverflow.com/questions/15965785/why-is-postgresql-9-1-not-using-index-for-simple-equality-select

Pasted here as well.  Thanks.

My table `lead` has an index:

\d lead
...
Indexes:
lead_pkey PRIMARY KEY, btree (id)
lead_account__c btree (account__c)
...
lead_email btree (email)
lead_id_prefix btree (id text_pattern_ops)

Why doesn't PG (9.1) use the index for this straightforward equality
selection?  Emails are almost all unique

db= explain select * from lead where email = 'blah';
 QUERY PLAN

 Seq Scan on lead  (cost=0.00..319599.38 rows=1 width=5108)
   Filter: (email = 'blah'::text)
(2 rows)

Other index-hitting queries seem to be OK (though I don't know why
this one doesn't just use the pkey index):

db= explain select * from lead where id = '';
  QUERY PLAN

--
 Index Scan using lead_id_prefix on lead  (cost=0.00..8.57 rows=1
width=5108)
   Index Cond: (id = ''::text)
(2 rows)

db= explain select * from lead where account__c = '';
QUERY PLAN

--
 Index Scan using lead_account__c on lead  (cost=0.00..201.05
rows=49 width=5108)
   Index Cond: (account__c = ''::text)
(2 rows)

At first I thought it may be due to not enough distinct values of
`email`.  For instance, if the stats claim that `email` is `blah` for
most of the table, then a seq scan is faster.  But that's not the
case:

db= select count(*), count(distinct email) from lead;
 count  | count
+
 749148 | 733416
(1 row)

Even if I force seq scans to be off, the planner behaves as if it has
no other choice:

db= set enable_seqscan = off;
SET
db= show enable_seqscan;
 enable_seqscan

 off
(1 row)

db= explain select * from lead where email = 'f...@blah.com';
QUERY PLAN
---
 Seq Scan on lead  (cost=100.00..1319599.38 rows=1 width=5108)
   Filter: (email = 'f...@blah.com'::text)
(2 rows)

I searched over a good number of past SO questions but none were about
a simple equality query like this one.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread John R Pierce

On 4/12/2013 1:03 AM, Yang Zhang wrote:

 db= explain select * from lead where email = 'blah';
  QUERY PLAN
 
  Seq Scan on lead  (cost=0.00..319599.38 rows=1 width=5108)
Filter: (email = 'blah'::text)



try EXPLAIN ANALYZE .its more useful.

my guess is, there's no statistics on this table, and doing an ANALYZE 
lead;  would rectify this.




--
john r pierce  37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Yang Zhang
Doesn't seem to be the case.  This table has been around for a while
and should have been auto-analyzed by now.  But anyway:

db= analyze lead;
ANALYZE
db= explain select * from lead where email = 'f...@blah.com';
QUERY PLAN
---
 Seq Scan on lead  (cost=100.00..1319666.99 rows=1 width=5208)
   Filter: (email = 'f...@blah.com'::text)
(2 rows)

On Fri, Apr 12, 2013 at 1:13 AM, John R Pierce pie...@hogranch.com wrote:
 On 4/12/2013 1:03 AM, Yang Zhang wrote:

  db= explain select * from lead where email = 'blah';
   QUERY PLAN
  
   Seq Scan on lead  (cost=0.00..319599.38 rows=1 width=5108)
 Filter: (email = 'blah'::text)



 try EXPLAIN ANALYZE .its more useful.

 my guess is, there's no statistics on this table, and doing an ANALYZE lead;
 would rectify this.



 --
 john r pierce  37N 122W
 somewhere on the middle of the left coast



 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general



-- 
Yang Zhang
http://yz.mit.edu/


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Automatic restart while upgrade

2013-04-12 Thread stephane . schildknecht

Hello,

I discovered that while upgrading PostgreSQL binaries through 'yum 
update', with PGDG RPMs, the service is automatically restarted.


ISTM that this was not the case before 9.2.

May you confirm that this is a new behaviour appearing in 9.2?

Is it intended, and is there a way to prevent the automatic restart?

Thanks in advance.

Best regards,
Stéphane Schildknecht
http://loxodata.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Alban Hertroys
On 12 April 2013 10:45, Yang Zhang yanghates...@gmail.com wrote:

 explain select * from lead where email = 'f...@blah.com';


What about:
explain analyze select * from lead where email = 'f...@blah.com';


-- 
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.


Re: [GENERAL] How to convert US date format to European date format ?

2013-04-12 Thread Condor

On 2013-04-12 10:59, John R Pierce wrote:

On 4/12/2013 12:42 AM, Condor wrote:
and ISO, DMY show me: 2012-10-15 11:00:49.397908 if I use Postgres, 
DMY show me

Mon 15 Oct 11:00:49.397908 2012

But I want to be formatted: 11:00:49 15-10-2012


use the date formatting functions, like...

select to_char(yourfield, 'HH:MI:SS DD-MM-') ...

see 
http://www.postgresql.org/docs/current/static/functions-formatting.html





--
john r pierce  37N 122W
somewhere on the middle of the left coast


Yes, I see this function but if I need to select 100 000 rows this mean 
I think,
this function will be start 100 000 times. I mean when I ask the 
question,
it's is possible to format the date how I like it without to use 
functions,
just something like: set datestyle ('postgres with my custom format 
00:00:00 dmy', DMY)

something like that. Sry that I did not explain it.


Cheers,
Hristo S.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to convert US date format to European date format ?

2013-04-12 Thread Pavel Stehule
2013/4/12 Condor con...@stz-bg.com

 On 2013-04-12 10:59, John R Pierce wrote:

 On 4/12/2013 12:42 AM, Condor wrote:

 and ISO, DMY show me: 2012-10-15 11:00:49.397908 if I use Postgres, DMY
 show me
 Mon 15 Oct 11:00:49.397908 2012

 But I want to be formatted: 11:00:49 15-10-2012


 use the date formatting functions, like...

 select to_char(yourfield, 'HH:MI:SS DD-MM-') ...

 see http://www.postgresql.org/**docs/current/static/functions-**
 formatting.htmlhttp://www.postgresql.org/docs/current/static/functions-formatting.html




 --
 john r pierce  37N 122W
 somewhere on the middle of the left coast


 Yes, I see this function but if I need to select 100 000 rows this mean I
 think,
 this function will be start 100 000 times. I mean when I ask the question,
 it's is possible to format the date how I like it without to use functions,
 just something like: set datestyle ('postgres with my custom format
 00:00:00 dmy', DMY)
 something like that. Sry that I did not explain it.


If you cannot use datestyle, then there are no any other possibility.
Postgres doesn't support custom datestyles.

Regards

Pavel



 Cheers,
 Hristo S.


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/**mailpref/pgsql-generalhttp://www.postgresql.org/mailpref/pgsql-general



Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread John R Pierce

On 4/12/2013 1:45 AM, Yang Zhang wrote:

db= explain select * from lead where email = 'f...@blah.com';


can you try

   explain analyze select * from lead where email = 'f...@blah.com';

?


--
john r pierce  37N 122W
somewhere on the middle of the left coast



Re: [GENERAL] Segmentation fault with core dump

2013-04-12 Thread Andres Freund
On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
 I wrote:
  (Wanders away wondering just how much the regression tests exercise
  holdable cursors.)
 
 And the answer is they're not testing this code path at all, because if
 you do
   DECLARE c CURSOR WITH HOLD FOR ...
   FETCH ALL FROM c;
 then the second query executes with a portal (and resource owner)
 created to execute the FETCH command, not directly on the held portal.
 
 After a little bit of thought I'm not sure it's even possible to
 reproduce this problem with libpq, because it doesn't expose any way to
 issue a bare protocol Execute command against a pre-existing portal.
 (I had thought psqlOBC went through libpq, but maybe it's playing some
 games here.)
 
 Anyway, I'm thinking the appropriate fix might be like this
 
 - CurrentResourceOwner = portal-resowner;
 + if (portal-resowner)
 + CurrentResourceOwner = portal-resowner;
 
 in several places in pquery.c; that is, keep using
 TopTransactionResourceOwner if the portal doesn't have its own.
 
 A more general but probably much more invasive solution would be to fake
 up an intermediate portal when pulling data from a held portal, to
 more closely approximate the explicit-FETCH case.

We could also allocate a new resowner for the duration of that
transaction. That would get reassigned to the transactions resowner in
PreCommit_Portals (after a slight change there).
That actually seems simple enough?

Greetings,

Andres Freund

-- 
 Andres Freund http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to convert US date format to European date format ?

2013-04-12 Thread Adrian Klaver

On 04/12/2013 01:54 AM, Condor wrote:





--
john r pierce  37N 122W
somewhere on the middle of the left coast


Yes, I see this function but if I need to select 100 000 rows this mean
I think,
this function will be start 100 000 times. I mean when I ask the question,
it's is possible to format the date how I like it without to use functions,
just something like: set datestyle ('postgres with my custom format
00:00:00 dmy', DMY)
something like that. Sry that I did not explain it.


FYI, DateStyle uses functions also, as the stored date has to be 
reformatted to whatever style is chosen. See datetime.c in the source 
for the functions. I would try to_char() and see if it makes a 
discernible difference in the select.





Cheers,
Hristo S.





--
Adrian Klaver
adrian.kla...@gmail.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Automatic restart while upgrade

2013-04-12 Thread Tom Lane
stephane.schildkne...@postgres.fr writes:
 I discovered that while upgrading PostgreSQL binaries through 'yum 
 update', with PGDG RPMs, the service is automatically restarted.

 ISTM that this was not the case before 9.2.

I dunno whether Devrim's packages acted that way before 9.2, but
this is standard behavior for all services in Red Hat environments,
and always has been.  Otherwise an intended security patch, for
instance, might not be activated till long past when the admin
thought he'd installed it.

regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Tom Lane
Yang Zhang yanghates...@gmail.com writes:
 db= explain select * from lead where email = 'blah';
  QUERY PLAN
 
  Seq Scan on lead  (cost=0.00..319599.38 rows=1 width=5108)
Filter: (email = 'blah'::text)
 (2 rows)

That's awfully odd.  What data type is the email column?

It seems possible also that the index on it is marked invalid.  I'd have
expected \d to tell you so, but maybe you're using a version of psql that
doesn't know about that.  It'd be interesting to look at
select * from pg_index where indexrelid = 'index name here'::regclass;


regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Yang Zhang
It's actually just `text`.

I updated my SO question with some more info including explain analyze
(no difference), \d,
and your last incantation.

Thanks!

On Fri, Apr 12, 2013 at 7:11 AM, Tom Lane t...@sss.pgh.pa.us wrote:
 Yang Zhang yanghates...@gmail.com writes:
 db= explain select * from lead where email = 'blah';
  QUERY PLAN
 
  Seq Scan on lead  (cost=0.00..319599.38 rows=1 width=5108)
Filter: (email = 'blah'::text)
 (2 rows)

 That's awfully odd.  What data type is the email column?

 It seems possible also that the index on it is marked invalid.  I'd have
 expected \d to tell you so, but maybe you're using a version of psql that
 doesn't know about that.  It'd be interesting to look at
 select * from pg_index where indexrelid = 'index name here'::regclass;


 regards, tom lane



--
Yang Zhang
http://yz.mit.edu/


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Tom Lane
Yang Zhang yanghates...@gmail.com writes:
 I updated my SO question with some more info including explain analyze
 (no difference), \d,
 and your last incantation.

The question is being asked here, not in SO, and I find it rather
impolite of you to expect me to go chasing off to some other forum
to answer your question.

regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Yang Zhang
Apologies for that Tom.  I will paste the information in line once I'm
back at my computer.  I do appreciate your help.

On Fri, Apr 12, 2013 at 10:24 AM, Tom Lane t...@sss.pgh.pa.us wrote:
 Yang Zhang yanghates...@gmail.com writes:
 I updated my SO question with some more info including explain analyze
 (no difference), \d,
 and your last incantation.

 The question is being asked here, not in SO, and I find it rather
 impolite of you to expect me to go chasing off to some other forum
 to answer your question.

 regards, tom lane



-- 
Yang Zhang
http://yz.mit.edu/


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread whiplash

Hello.

This is simple example for describe my problem.

I created a table:

CREATE TABLE table0
(
id serial NOT NULL,
field0 integer,
field1 text
);

I created an unique index for this table:

CREATE UNIQUE INDEX idx_table0_unique
ON table0 ( field0, coalesce ( field1, 'INDEX_COLUMN_NULL' ) );

I created function for insert only unique record (part of code):

BEGIN
INSERT INTO table0 ( field0, field1 ) VALUES ( p_field0, p_field1 ) 
RETURNING id INTO v_table0_id;

EXCEPTION WHEN unique_violation THEN
SELECT id FROM table0 WHERE field0 = p_field0 AND field1 = p_field1;
END;

I use this function for add data to table and sometimes I getting false 
unique violation (in block above). Why?


Thanks for replay.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Automatic restart while upgrade

2013-04-12 Thread Gavin Flower

On 13/04/13 02:08, Tom Lane wrote:

stephane.schildkne...@postgres.fr writes:

I discovered that while upgrading PostgreSQL binaries through 'yum
update', with PGDG RPMs, the service is automatically restarted.
ISTM that this was not the case before 9.2.

I dunno whether Devrim's packages acted that way before 9.2, but
this is standard behavior for all services in Red Hat environments,
and always has been.  Otherwise an intended security patch, for
instance, might not be activated till long past when the admin
thought he'd installed it.

regards, tom lane


As far as I can recall: that is standard yum behaviour for all packages 
updated, rather than installed, for over 10 years,  I first stared using 
Red Hat, now Fedora, in about 2001.


Cheers,
Gavin


[GENERAL] GSL onto postgresql server 9.2

2013-04-12 Thread Yuriy Rusinov
Hello, colleagues !

I have to put some C-language functions onto postgresql server 9.2. These
functions are used GSL software library http://www.gnu.org/software/gsl/.
In Makefile for these functions I wrote LD_FLAGS = ... -lgsl, On some
source-based Linux distributions such as gentoo linux these functions
successfully installed onto server, but on rpm-based distributions such as
fedora and others does not. gsl library has to be compiled from sources,
because some specific distributions does not have this one and
rpm-installation of this library does not allowed. Error message is error
mylibrary.so cannot load libgsl.so.0 no such file despite of gsl library
was installed onto /usr/local, library files are installed into
/usr/local/lib. Where is the problem in postgresql or distribution ?

-- 
Best regards,
Sincerely yours,
Yuriy Rusinov.


Re: [GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread Kevin Grittner
whiplash whipl...@bss.org.ua wrote:

 sometimes I getting false unique violation

How do you know that they are false?

What version of PostgreSQL is this?

Can you create a small self-contained test case that demonstrates
the issue?  (The snippets you provided probably excluded the cause
of the problem.)

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread Jeff Janes
On Fri, Apr 12, 2013 at 8:44 AM, whiplash whipl...@bss.org.ua wrote:


 CREATE UNIQUE INDEX idx_table0_unique
 ON table0 ( field0, coalesce ( field1, 'INDEX_COLUMN_NULL' ) );

 I created function for insert only unique record (part of code):

 BEGIN
 INSERT INTO table0 ( field0, field1 ) VALUES ( p_field0, p_field1 )
 RETURNING id INTO v_table0_id;
 EXCEPTION WHEN unique_violation THEN
 SELECT id FROM table0 WHERE field0 = p_field0 AND field1 = p_field1;
 END;

 I use this function for add data to table and sometimes I getting false
 unique violation (in block above). Why?


if p_field1 is NULL, then the select cannot return any rows, but can still
violate the constraint.

Also, you may have a race, where the row exists when the insert was
attempted, but was gone by the time it tried to do the select.

Cheers,

Jeff