Re: [GENERAL] libpq

2012-12-04 Thread John R Pierce
On 12/4/2012 11:15 PM, Philipp Kraus wrote: I would like to build a C program, that can access to a Postgres database and I would like to compile the client myself. I think I need "libpq" for access the database, but I can not download the sources of the driver, becausewww.libpqxx.org seems t

[GENERAL] libpq

2012-12-04 Thread Philipp Kraus
Hello, I would like to build a C program, that can access to a Postgres database and I would like to compile the client myself. I think I need "libpq" for access the database, but I can not download the sources of the driver, because www.libpqxx.org seems to be down. Where can download the sou

Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Alan Hodgson
On Wednesday, December 05, 2012 02:44:39 AM Edson Richter wrote: > Sort (cost=11938.72..11938.74 rows=91 width=93) >Sort Key: t0.nome >-> Nested Loop (cost=0.00..11938.42 rows=91 width=93) > -> Nested Loop (cost=0.00..11935.19 rows=91 width=85) >-> Seq Scan on

Re: [GENERAL] ts_headline and query with hyphen

2012-12-04 Thread daniel
As a follow up to my previous comment, this is a cutting example select ts_headline('game played on-line', to_tsquery('on-line & game'), 'MaxWords=3,MinWords=2,ShortWord=1'); ts_headline --- game played on that can't be right... daniel -- Sent via pgsql-general

Re: [GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Lonni J Friedman
I'm no expert on this, but it will likely be more helpful to others if you include the table description with all the indices. On Tue, Dec 4, 2012 at 8:44 PM, Edson Richter wrote: > I've a table with >110 rows, with streets. > I'm making a partial search using zip code, and PostgreSQL is igno

[GENERAL] Table with million rows - and PostgreSQL 9.1 is not using the index

2012-12-04 Thread Edson Richter
I've a table with >110 rows, with streets. I'm making a partial search using zip code, and PostgreSQL is ignoring my ZIP index. I'm sure I'm making some mistake, but I can't see where. The query is: SELECT t2.ID, t2.CEP, t2.COMPLEMENTO, t2.NOME, t2.NOMESEMACENTOS, t2.TIPO, t2.BAIRRO_ID

Re: [GENERAL] ts_headline and query with hyphen

2012-12-04 Thread daniel
On 12/05/2012 04:49 AM, Tom Lane wrote: daniel writes: I have a question about ts_headline, when the query includes word like 'on-line' - only the 'line' part is highlighted, even though the whole phrase is indexed too, some details below. Part of the reason is that "on" is a stop word (at le

Re: [GENERAL] how do I grant select to one user for all tables in a DB?

2012-12-04 Thread Chris Angelico
On Wed, Dec 5, 2012 at 2:12 PM, Gauthier, Dave wrote: > V9.1.5 on linux > User "select" created (yup, that's right, they want the user name to be > "select". Guess what ptivs it is to have! Don't kill the messanger :-) ) > > postgres=# grant select on all tables in schema sde to "select"; > > ERR

Re: [GENERAL] Statistics mismatch between n_live_tup and actual row count

2012-12-04 Thread tim_wilson
I am also seeing a drift in the n_live_tup value compared to actual row count on the table on PG9.0.6 It drifts after a vacuum , you can bring it back closer to the actual number by running ANALYSE several times, you can lock it back into the right value with a vacuum full, but then if you run a v

Re: [GENERAL] ts_headline and query with hyphen

2012-12-04 Thread Tom Lane
daniel writes: > I have a question about ts_headline, when the query includes word like > 'on-line' - only the 'line' part is highlighted, even though the whole > phrase is indexed too, some details below. Part of the reason is that "on" is a stop word (at least in the default english dictionar

[GENERAL] ts_headline and query with hyphen

2012-12-04 Thread daniel
Hi I have a question about ts_headline, when the query includes word like 'on-line' - only the 'line' part is highlighted, even though the whole phrase is indexed too, some details below. Postgresql 9.1.6 select token, dictionary, lexemes from ts_debug('play on-line') where alias <> 'blank';

[GENERAL] how do I grant select to one user for all tables in a DB?

2012-12-04 Thread Gauthier, Dave
V9.1.5 on linux User "select" created (yup, that's right, they want the user name to be "select". Guess what ptivs it is to have! Don't kill the messanger :-) ) postgres=# grant select on all tables in schema sde to "select"; ERROR: schema "sde" does not exist postgres=# \l

Re: [GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Kenneth Tilton
On Tue, Dec 4, 2012 at 8:26 PM, Raymond O'Donnell wrote: > On 05/12/2012 01:11, Raymond O'Donnell wrote: > > On 05/12/2012 01:04, Kenneth Tilton wrote: > >> I am porting from MySQL some code that has to take an arbitrary query > >> involving joins and build up a dictionary (in an HLL talking to P

Re: [GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Raymond O'Donnell
On 05/12/2012 01:11, Raymond O'Donnell wrote: > On 05/12/2012 01:04, Kenneth Tilton wrote: >> I am porting from MySQL some code that has to take an arbitrary query >> involving joins and build up a dictionary (in an HLL talking to Postgres >> over a socket) where each column name will be the key. T

Re: [GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Raymond O'Donnell
On 05/12/2012 01:04, Kenneth Tilton wrote: > I am porting from MySQL some code that has to take an arbitrary query > involving joins and build up a dictionary (in an HLL talking to Postgres > over a socket) where each column name will be the key. The catch is that > there will be duplicate entries

[GENERAL] How get column-wise table info from an arbitrary query?

2012-12-04 Thread Kenneth Tilton
I am porting from MySQL some code that has to take an arbitrary query involving joins and build up a dictionary (in an HLL talking to Postgres over a socket) where each column name will be the key. The catch is that there will be duplicate entries where two joined tables have the same column such a

Re: [GENERAL] Permission denied in file_fdw (Windows)

2012-12-04 Thread Tomas Vondra
Hi, On 5.12.2012 00:39, Stefan Keller wrote: > Hi > > I'm getting an error when reading from a file_fdw table in a Windows > environment. > Any hints? (see below). Well, the file clearly isn't accessible by the postgres user (or whatever user you're using in Windows). The file is opened from a P

Re: [GENERAL] Permission denied in file_fdw (Windows)

2012-12-04 Thread Raymond O'Donnell
On 04/12/2012 23:39, Stefan Keller wrote: > Hi > > I'm getting an error when reading from a file_fdw table in a Windows > environment. > Any hints? (see below). > > And http://www.postgresql.org/docs/9.1/static/file-fdw.html is not > really verbose :-> > At least following format options should b

[GENERAL] Permission denied in file_fdw (Windows)

2012-12-04 Thread Stefan Keller
Hi I'm getting an error when reading from a file_fdw table in a Windows environment. Any hints? (see below). And http://www.postgresql.org/docs/9.1/static/file-fdw.html is not really verbose :-> At least following format options should be mentioned: 'xml', 'text', 'csv', 'binary'. Yours, Stefan

Re: [GENERAL] Postgresql logfilename and times in GMT - not EST

2012-12-04 Thread Lonni J Friedman
On Tue, Dec 4, 2012 at 2:42 PM, Tom Lane wrote: > Lonni J Friedman writes: >> On Tue, Dec 4, 2012 at 1:59 PM, Bryan Montgomery wrote: >>> I changed postgres.conf to have timezone = 'EST' and restarted postgres. >>> However the log file is still 5 hours ahead. What gives? Not the end of the >>> w

Re: [GENERAL] Postgresql logfilename and times in GMT - not EST

2012-12-04 Thread Tom Lane
Lonni J Friedman writes: > On Tue, Dec 4, 2012 at 1:59 PM, Bryan Montgomery wrote: >> I changed postgres.conf to have timezone = 'EST' and restarted postgres. >> However the log file is still 5 hours ahead. What gives? Not the end of the >> world but a bit annoying. > you need to set log_timezon

Re: [GENERAL] Postgresql logfilename and times in GMT - not EST

2012-12-04 Thread Lonni J Friedman
On Tue, Dec 4, 2012 at 1:59 PM, Bryan Montgomery wrote: > We have a test 9.2.0 db running on openSuse 12.2. When I select now() I get > the correct timezone and date back (-5 hours). > When I do date at the os prompt, I get the right timezone back. > > I changed postgres.conf to have timezone = 'E

[GENERAL] Postgresql logfilename and times in GMT - not EST

2012-12-04 Thread Bryan Montgomery
We have a test 9.2.0 db running on openSuse 12.2. When I select now() I get the correct timezone and date back (-5 hours). When I do date at the os prompt, I get the right timezone back. I changed postgres.conf to have timezone = 'EST' and restarted postgres. However the log file is still 5 hours

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Pavel Stehule
Hello 2012/12/4 Edson Richter : > Em 04/12/2012 18:49, Sergey Konoplev escreveu: > >> On Tue, Dec 4, 2012 at 5:57 AM, Edson Richter >> wrote: >>> >>> In this specific case, the full length (14) is mandatory... so seems >>> there >>> is no loss or gain. >>> Also, I see all varchar(...) created are

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Edson Richter
Em 04/12/2012 18:49, Sergey Konoplev escreveu: On Tue, Dec 4, 2012 at 5:57 AM, Edson Richter wrote: In this specific case, the full length (14) is mandatory... so seems there is no loss or gain. Also, I see all varchar(...) created are by default "storage = EXTENDED" (from "Pg Admin"), while ot

[GENERAL] pg_shadow and pgcrypto

2012-12-04 Thread Frank Cavaliero
Hi all, I'm currently performing a hash check for password verification.I'm generating an md5 hash or checking for plain text in pg_shadow. However, outside of these two "out-of-the-box" options, what if someone is using pg-crypto or any other PAM ? How can I differentiate between say md

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Sergey Konoplev
On Tue, Dec 4, 2012 at 5:57 AM, Edson Richter wrote: > In this specific case, the full length (14) is mandatory... so seems there > is no loss or gain. > Also, I see all varchar(...) created are by default "storage = EXTENDED" > (from "Pg Admin"), while other datatypes (like numeric, smallint, int

Re: [GENERAL] UPDATE using subquery with joined tables

2012-12-04 Thread Paul Jungwirth
Seems like this should work (untested though): UPDATE table1 a SET field1 = a.field1 || (SELECT regexp_replace(b.field1, '', '...') FROM table2 b WHERE a.id = b.id AND b.field1 LIKE '') WHERE a.field1 NOT LIKE '' Paul On Tue, Dec 4, 2012 at 11:52 AM, Sebastian P. Luque wrote: > Hi

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Gavin Flower
On 05/12/12 06:06, Edson Richter wrote: Em 04/12/2012 14:59, hari.fu...@gmail.com escreveu: Edson Richter writes: In this specific case, the full length (14) is mandatory... so seems there is no loss or gain. Also, I see all varchar(...) created are by default "storage = EXTENDED" (from "Pg A

Re: [GENERAL] UPDATE using subquery with joined tables

2012-12-04 Thread David Johnston
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Sebastian P. Luque > Sent: Tuesday, December 04, 2012 2:53 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] UPDATE using subquery with joined tables > > Hi

[GENERAL] UPDATE using subquery with joined tables

2012-12-04 Thread Sebastian P. Luque
Hi, I need to update field1 in table1, gathering data from field1 in table2. The following SELECT shows the data as it needs to be updated: SELECT a.field1 || regexp_replace(b.field1, '.*(mypattern)', e'. \\1') FROM table1 a JOIN table2 b USING (id) WHERE a.field1 NOT LIKE '%mypattern%' AND b.fie

Re: [GENERAL] libpq error message deallocation

2012-12-04 Thread icholy
thanks for the quick reply! -- View this message in context: http://postgresql.1045698.n5.nabble.com/libpq-error-message-deallocation-tp5735032p5735046.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql

Re: [GENERAL] libpq error message deallocation

2012-12-04 Thread Dmitriy Igrishin
2012/12/4 icholy > PQerrorMessage function return char const* > > char const* msg = PQerrorMessage(conn); > > Now since it's const, I don't think I should be deallocating it and I've > never seen that done in any examples. But then, when and how does it get > freed? > > At first I thought it

[GENERAL] libpq error message deallocation

2012-12-04 Thread icholy
PQerrorMessage function return char const* char const* msg = PQerrorMessage(conn); Now since it's const, I don't think I should be deallocating it and I've never seen that done in any examples. But then, when and how does it get freed? At first I thought it gets deallocated once another error m

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Edson Richter
Em 04/12/2012 14:59, hari.fu...@gmail.com escreveu: Edson Richter writes: In this specific case, the full length (14) is mandatory... so seems there is no loss or gain. Also, I see all varchar(...) created are by default "storage = EXTENDED" (from "Pg Admin"), while other datatypes (like numer

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread hari . fuchs
Edson Richter writes: > In this specific case, the full length (14) is mandatory... so seems > there is no loss or gain. > Also, I see all varchar(...) created are by default "storage = > EXTENDED" (from "Pg Admin"), while other datatypes (like numeric, > smallint, integer) are "storage = MAIN".

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Edson Richter
Em 04/12/2012 12:53, Kevin Grittner escreveu: Edson Richter wrote: Also, I see all varchar(...) created are by default "storage = EXTENDED" (from "Pg Admin"), while other datatypes (like numeric, smallint, integer) are "storage = MAIN". That's unlikely to matter on a 14 character value. Can

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Kevin Grittner
Edson Richter wrote: > Also, I see all varchar(...) created are by default "storage = > EXTENDED" (from "Pg Admin"), while other datatypes (like numeric, > smallint, integer) are "storage = MAIN". That's unlikely to matter on a 14 character value. > Can I have a gain using fixed length datatype

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Edson Richter
Em 04/12/2012 11:50, Pavel Stehule escreveu: Hello 2012/12/4 Edson Richter : I think I already know the answer (char(14)), but I would like to confirm: which is faster? In Brazil, company id has 14 digits (12 identifiers, 2 control digits). By today, application use varchar(14) for these, but

Re: [GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Bruce Momjian
On Tue, Dec 4, 2012 at 11:44:20AM -0200, Edson Richter wrote: > I think I already know the answer (char(14)), but I would like to > confirm: which is faster? > > In Brazil, company id has 14 digits (12 identifiers, 2 control > digits). By today, application use varchar(14) for these, but I > inte

[GENERAL] Which is faster: char(14) or varchar(14)

2012-12-04 Thread Edson Richter
I think I already know the answer (char(14)), but I would like to confirm: which is faster? In Brazil, company id has 14 digits (12 identifiers, 2 control digits). By today, application use varchar(14) for these, but I intend to optimize insert/update/delete and search, and I'm considering to

Re: [GENERAL] SETOF come ritorno delle funzioni

2012-12-04 Thread Vincent Veyron
Le lundi 03 décembre 2012 à 08:29 +0100, Pavel Stehule a écrit : > Hello > > sorry, a used language in this mailing list is English language > You're right, of course, but I'll try and answer since I read a bit of Italian. Piviul, si deve scrivere in inglese qua, per ottenere delle risposte.

Re: [GENERAL] Set returning functions in the SELECT list

2012-12-04 Thread Jasen Betts
On 2012-11-16, Tom Lane wrote: > Ryan Kelly writes: >> I have a question about the behavior of SRFs in the SELECT list. > > If you have more than one in a select list, the number of resulting rows > is the least common multiple of their periods, because the select list > gets cycled until they al

Re: [GENERAL] Database schema

2012-12-04 Thread Andreas Kretschmer
Albe Laurenz wrote: > Dhiraj Gupta wrote: > > I have  created a database name '"ofbiz". then the default  schema name > > "public " > > created automatically. I want to create schema name ofbiz in the database > > "ofbiz" > > when I create database name "ofbiz" then the schema name "ofbiz" will

Re: [GENERAL] Database schema

2012-12-04 Thread Greg Williamson
Dhiraj -- > > From: Dhiraj Gupta >To: pgsql-general@postgresql.org >Sent: Sunday, December 2, 2012 9:35 PM >Subject: [GENERAL] Database schema > > > Hi All, >I have  created a database name '"ofbiz". then the default  schema name >"public " created automatical

Re: [GENERAL] Database schema

2012-12-04 Thread Albe Laurenz
Dhiraj Gupta wrote: > I have  created a database name '"ofbiz". then the default  schema name > "public " > created automatically. I want to create schema name ofbiz in the database > "ofbiz" > when I create database name "ofbiz" then the schema name "ofbiz" will create >automatically. > how it

[GENERAL] RE: [GENERAL] Strange Connection Problem….

2012-12-04 Thread Albe Laurenz
Jerry LeVan wrote: > I recently modified one of my Fedora boxes by changing it's name and ip. > > I also disabled the internal wifi ( connection speed was dropping to 1 mb/sec > ) and > configured a USB wifi stick ( wow 270~300 mb/sec ). > > As I checked out the refurbed box networking was ok an