Re: [GENERAL] text and bytea

2008-02-24 Thread Martijn van Oosterhout
On Fri, Feb 22, 2008 at 01:54:46PM -0200, hernan gonzalez wrote: > > It seems to me that postgres is trying to do as you suggest: text is > > characters and bytea is bytes, like in Java. > > But the big difference is that, for text type, postgresql knows "this > is a text" but doesnt know the en

[GENERAL] autovacuum not freeing up unused space on 8.3.0

2008-02-24 Thread Stuart Brooks
It appears (and I am open to correction) that autovacuum is not operating correctly in 8.3.0. I have a vanilla installation where autovacuum is enabled, and is running with all the default settings. I have a table which is continually having rows added to it (~50/sec). For the sake of this exa

Re: [GENERAL] More formal definition of functions in documentation

2008-02-24 Thread Chris
Joris Dobbelsteen wrote: Dear, I'm currently reading through the Postgresql documentation about how several functions work and which ones I would need. So far the documentation is great and well-structured! Unfortunally I'm not sure what functions will actually do when some non-obvious input is

Re: [GENERAL] request help forming query

2008-02-24 Thread Vyacheslav Kalinin
Given that (type_id, group_id) is the PK of widgets it is possible to avoid self-join: select group_id from widgets where type_id = A or type_id = B group by group_id having count(1) = 2; ---(end of broadcast)--- TIP 3: Have you checked our extens

Re: [GENERAL] reindexing

2008-02-24 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > On Fri, Feb 22, 2008 at 12:24 PM, LARC/J.L.Shipman/jshipman > <[EMAIL PROTECTED]> wrote: >> I am reindexing my 7.1.4 postgres database. > My pgsql-fu regarding obsolete versions is obsolete. You do realize > that 7.1.x hasn't been supported for a very

Re: [GENERAL] Planner: rows=1 after "similar to" where condition.

2008-02-24 Thread Scott Marlowe
On Sun, Feb 24, 2008 at 4:35 PM, Joris Dobbelsteen <[EMAIL PROTECTED]> wrote: > I seem to have some planner oddity, where it seems to completely > mispredict the output after a regex compare. I've seem it on other > occasions, where it completely screws up the join. You can note the > "rows=1" a

Re: [GENERAL] request help forming query

2008-02-24 Thread brian
danmcb wrote: Hi !'ve been wondering how to formulate a query to get a set of objects out of a database, and am a bit stuck. I hope that someone here might be able to help. This is what the db looks like: Table TYPES id int primary key, description text Table GROUPS id int primary key descrip

[GENERAL] request help forming query

2008-02-24 Thread danmcb
Hi !'ve been wondering how to formulate a query to get a set of objects out of a database, and am a bit stuck. I hope that someone here might be able to help. This is what the db looks like: Table TYPES id int primary key, description text Table GROUPS id int primary key description text Table

Re: [GENERAL] no-arg cluster and locks ...

2008-02-24 Thread Adam Rich
> Can you provide more details? pg_locks, pg_stat_activity, the deadlock > message? > > (Hmm, it would be helpful if the deadlock checker were to save the > pg_locks contents and perhaps pg_stat_activity in a file, whenever a > deadlock is detected.) Great idea! As somebody who's spent hours tr

Re: [GENERAL] no-arg cluster and locks ...

2008-02-24 Thread Alvaro Herrera
James Robinson wrote: > How does 8.2 [ or 8.3 ] deal with table locking in the face of no- > argument 'cluster' command? Does it lock all tables it is going to visit > 'up front', or does it collect locks slowly as it visits tables? If it > only locks a new table before it visits it, does it unl

Re: [GENERAL] "RETURNS SETOF" function question

2008-02-24 Thread Erik Jones
On Feb 24, 2008, at 4:19 PM, Kynn Jones wrote: Suppose that stored procedure foo has the signature: foo( text, text ) RETURNS SETOF text Also, I have some table bar, and that column bar.baz is of type text. Now, I'd like to run something like SELECT foo( "frobozz", baz ) FROM bar; If

Re: [GENERAL] reindexing

2008-02-24 Thread Scott Marlowe
On Fri, Feb 22, 2008 at 12:24 PM, LARC/J.L.Shipman/jshipman <[EMAIL PROTECTED]> wrote: > Hi, > I am reindexing my 7.1.4 postgres database. The postmaster seems to > create processes for each reindex request. Is there any way to find > out more about the processes. > > ps -aef | grep po

[GENERAL] no-arg cluster and locks ...

2008-02-24 Thread James Robinson
How does 8.2 [ or 8.3 ] deal with table locking in the face of no- argument 'cluster' command? Does it lock all tables it is going to visit 'up front', or does it collect locks slowly as it visits tables? If it only locks a new table before it visits it, does it unlock it once it is done?

Re: [GENERAL] v7.4 pg_dump(all) need to encode from SQL_ASCII to UTF8

2008-02-24 Thread Dean Gibson (DB Administrator)
On 2008-02-22 17:57, Ralph Smith wrote: I'm looking at the v7.4 manuals and I don't see how to encode for importing into a v8 DB using UTF8. Maybe I'm making this hard on myself? The old DB is using SQL_ASCII. We'd like the new one to use UTF8. As development proceeds, I'm going to have to do

Re: [GENERAL] plpgsql function

2008-02-24 Thread Tom Lane
Andreas Kendlinger <[EMAIL PROTECTED]> writes: > I wrote a little stored function to simulate the EXTRACT(YEAR_MONTH ...) > from mySQL. > ... > One Method call requires 53ms. Really? Near as I can tell, it takes about 130 microsec on my ancient HPPA machine, which is surely as slow as anything a

[GENERAL] Planner: rows=1 after "similar to" where condition.

2008-02-24 Thread Joris Dobbelsteen
I seem to have some planner oddity, where it seems to completely mispredict the output after a regex compare. I've seem it on other occasions, where it completely screws up the join. You can note the "rows=1" after the filter. A similar sitution has occurred when doing a regex filter in a subquery,

[GENERAL] More formal definition of functions in documentation

2008-02-24 Thread Joris Dobbelsteen
Dear, I'm currently reading through the Postgresql documentation about how several functions work and which ones I would need. So far the documentation is great and well-structured! Unfortunally I'm not sure what functions will actually do when some non-obvious input is provided (which is sometim

[GENERAL] "RETURNS SETOF" function question

2008-02-24 Thread Kynn Jones
Suppose that stored procedure foo has the signature: foo( text, text ) RETURNS SETOF text Also, I have some table bar, and that column bar.baz is of type text. Now, I'd like to run something like SELECT foo( "frobozz", baz ) FROM bar; If I try this psql complains that I'm trying to execute

Re: [GENERAL] text and bytea

2008-02-24 Thread hernan gonzalez
> It seems to me that postgres is trying to do as you suggest: text is > characters and bytea is bytes, like in Java. But the big difference is that, for text type, postgresql knows "this is a text" but doesnt know the encoding, as my example showed. This goes against the concept of "text vs byt

[GENERAL] v7.4 pg_dump(all) need to encode from SQL_ASCII to UTF8

2008-02-24 Thread Ralph Smith
I'm looking at the v7.4 manuals and I don't see how to encode for importing into a v8 DB using UTF8. Maybe I'm making this hard on myself? The old DB is using SQL_ASCII. We'd like the new one to use UTF8. As development proceeds, I'm going to have to do this regularly, both the entire DB and

[GENERAL] Cascading Trigger - changing row on delete does not delete row

2008-02-24 Thread D. Dante Lorenso
All, I have 2 tables which both have triggers on them. When I delete a row on table A, a cascading trigger ends up modifying rows in table B. The modified rows in table B trigger an update on rows in table A which happens to be the same row that I am trying to delete. I don't get any error

[GENERAL] reindexing

2008-02-24 Thread LARC/J.L.Shipman/jshipman
Hi, I am reindexing my 7.1.4 postgres database. The postmaster seems to create processes for each reindex request. Is there any way to find out more about the processes. ps -aef | grep postgres yields the following, but does not tell me which table is being reindexed or anything meanin

[GENERAL] Cascading Trigger - changing row on delete does not delete row

2008-02-24 Thread D. Dante Lorenso
All, I have 2 tables which both have triggers on them. When I delete a row on table A, a cascading trigger ends up modifying rows in table B. The modified rows in table B trigger an update on rows in table A which happens to be the same row that I am trying to delete. I don't get any error

[GENERAL] plpgsql function

2008-02-24 Thread Andreas Kendlinger
Hello. I wrote a little stored function to simulate the EXTRACT(YEAR_MONTH ...) from mySQL. //- CREATE OR REPLACE FUNCTION "BiSCAT_combined".extractyearmonth(date timestamp without time zone) RETURNS character varying AS $BODY$ DECLARE i INTEGER; BE

Re: [GENERAL] unnesesary sorting after Merge Full Join

2008-02-24 Thread Simon Riggs
On Sat, 2008-02-23 at 14:49 -0600, Decibel! wrote: > On Feb 21, 2008, at 4:08 AM, Alexey Nalbat wrote: > > I found comment in src/backend/optimizer/path/pathkeys.c: > > * EXCEPTION: in a FULL or RIGHT join, we cannot treat the result as > > * having the outer path's path keys, because null lefthan

Re: [GENERAL] configure build flags

2008-02-24 Thread Alban Hertroys
On Feb 22, 2008, at 3:29 PM, [EMAIL PROTECTED] wrote: Hi All. Anyone knows if rebuilding the postgresql sources with the flag -- without-tcl --without-perl in ./configure file can prevent the correct use of the triggers wrote in plpgsql language? Wich behaviour I've to expect in postgres usi

Re: [GENERAL] How to make update rapidly?

2008-02-24 Thread Alban Hertroys
On Feb 20, 2008, at 5:03 AM, hewei wrote: table: CREATE TABLE price ( TIMESTAMP Timestamp NULL, idnumeric(5,0) NOT NULL, price numeric(10,3) NULL, primary key (id) ); sql: update price set price=* where id=*; So you have about 714us on average per query. That's not

Re: [GENERAL] Trigram performance penalty on varchar?

2008-02-24 Thread Alban Hertroys
On Feb 21, 2008, at 10:56 AM, Mario Lopez wrote: Hi, I am indexing a 100 million record table composed of varchar(255) as the field to be indexed. I have always seen that examples of pg_trgm are based on text type fields. Is this by any special reason?. A varchar is internally represented

Re: [GENERAL] Regex query not using index

2008-02-24 Thread Alban Hertroys
On Feb 20, 2008, at 5:51 PM, Postgres User wrote: Now to end my fixation, one last item. What about the case of a null or empty param value- is there a way to assign a condition value that Postgres will ignore when processing the query? This syntax results in a seq scan: WHERE fielda = Coale