Re: [GENERAL] Lockless pg_buffercache

2008-02-10 Thread Scott Marlowe
On Feb 9, 2008 10:34 PM, Markus Bertheau <[EMAIL PROTECTED]> wrote: > Hi, > > I want to use the pg_buffercache contrib module for monitoring our > server. It takes a lock on all buffers and then on each buffer header > in order to get a consistent picture of the buffers. I would be > running the fu

Re: [GENERAL] POLL: Women-sized t-shirts for PostgreSQL

2008-02-10 Thread Lincoln Yeoh
At 08:48 AM 2/9/2008, Alvaro Herrera wrote: Joshua D. Drake escribió: > Richard Broersma Jr wrote: >> I personally wouldn't even mind having a PG polo that has 3rd part >> vendor logos on the sleeves if that would help make PG polo shirts >> available. > > O.k., o.k. :) I will look into costs.

[GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Dave Livesay
Can anyone interpret this error message? It appears in response to each of the following queries in one instance of PostgreSQL 8.3: SELECT usecreatedb, usesuper, CASE WHEN usesuper THEN pg_postmaster_start_time() ELSE NULL END as upsince FROM pg_user WHERE usename=current_user ; SELECT rolc

Re: [GENERAL] Where is the system-wide psqlrc on RHEL4?

2008-02-10 Thread Andrej Ricnik-Bay
On 10/02/2008, Dean Gibson (DB Administrator) <[EMAIL PROTECTED]> wrote: > It's not installed in the base/server/libs RPMs. I had to search the > uninstalled PostgreSQL RPMs for it, and then (temporarily) install the > "devel" RPM to run it. For CentOS 4.4 & RHEL4, the system-wide psqlrc > is in

Re: [GENERAL] Lockless pg_buffercache

2008-02-10 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > So, what's the real burden like from the pg_buffercache contrib module? I wonder whether pg_buffercache should be changed to work like the statistics views do, ie, you take a snapshot during the first call within a transaction. This would allow correl

Re: [GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Tom Lane
Dave Livesay <[EMAIL PROTECTED]> writes: > Can anyone interpret this error message? Something's whacked out about your ON SELECT rules for these views. Further than that is harder to say --- have you tried looking at \d output for them, or looked into pg_rewrite? > It appears in response to each

Re: [GENERAL] Is PG a moving target?

2008-02-10 Thread Dave Livesay
I noticed that, in one of the third-party databases I have installed on my server, one foreign key constraint could not be implemented. (The key columns are of incompatible types.) In previous upgrades I had seen a warning concerning this constraint, and had passed this information along to

[GENERAL] Alter Temporary table in Stored Procedure

2008-02-10 Thread Nykolyn, Andrew
Does any know of a way that I can alter a temporary table by adding a serial column within a stored procedure after it has been created? Any help greatly appreciated. Thanks. Andy Nykolyn Northrop Grumman

Re: [GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Dave Livesay
The history is rather interesting. :-) This is the first version of PostgreSQL provided by a certain very helpful fellow, who has been making PostgreSQL binaries available for us Mac users for years, since he upgraded to Mac OS X 10.5 (aka Leopard). I have not yet upgraded to Leopard, due t

Re: [GENERAL] Is PG a moving target?

2008-02-10 Thread Erik Jones
On Feb 10, 2008, at 10:44 AM, Dave Livesay wrote: I noticed that, in one of the third-party databases I have installed on my server, one foreign key constraint could not be implemented. (The key columns are of incompatible types.) In previous upgrades I had seen a warning concerning this c

[GENERAL] Change column type to numeric

2008-02-10 Thread Jake Franklin
Forgive me if this question has an obvious answer, I'm sorta new to posgresql. I have a table that's already populated with quite a bit of records. I'd like to alter a column called "amount" from character varying to numeric, so I don't have to re-load all of my data sets. I've already dropped th

Re: [GENERAL] Change column type to numeric

2008-02-10 Thread Michael Fuhr
On Sun, Feb 10, 2008 at 11:37:45AM -0700, Jake Franklin wrote: > test=# alter table foo alter column amount type numeric(10,2) USING > cast(amount AS numeric); > ERROR: invalid input syntax for type numeric: "" > > I'm assuming that it's trying to cast a blank value as numeric and > failing. Doe

Re: [GENERAL] Alter Temporary table in Stored Procedure

2008-02-10 Thread Tom Lane
"Nykolyn, Andrew" <[EMAIL PROTECTED]> writes: > Does any know of a way that I can alter a temporary table by adding a > serial column within a stored procedure after it has been created? It should just work. What did you try, exactly, and what error message did you get? r

Re: [GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Tom Lane
Dave Livesay <[EMAIL PROTECTED]> writes: > This is the first version of PostgreSQL provided by a certain very > helpful fellow, who has been making PostgreSQL binaries available for > us Mac users for years, since he upgraded to Mac OS X 10.5 (aka > Leopard). I have not yet upgraded to Leopar

Re: [GENERAL] Alter Temporary table in Stored Procedure

2008-02-10 Thread Nykolyn, Andrew
> Does any know of a way that I can alter a temporary table by adding a > serial column within a stored procedure after it has been created? It should just work. What did you try, exactly, and what error message did you get? I have the following code in my stored procedure: create tem

Re: [GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Dave Livesay
On Feb 10, 2008, at 2:21 PM, Tom Lane wrote: Dave Livesay <[EMAIL PROTECTED]> writes: This is the first version of PostgreSQL provided by a certain very helpful fellow, who has been making PostgreSQL binaries available for us Mac users for years, since he upgraded to Mac OS X 10.5 (aka Leopard)

Re: [GENERAL] Trouble with Mixed UTF-8 and Latin1 data

2008-02-10 Thread Hannes Dorbath
valgog wrote: I know it looks like a mess Indeed, that is what client encoding is for :) One idea is to write the function, that will normalize the data to UTF-8 in PL/pgSQL (that I could not do from the first try) You could use convert(), iterate over the rows and catch the exceptions in pl

[GENERAL] 8.3: where's the replacement tsearch2 module?

2008-02-10 Thread Pierre Thibaudeau
I just downloaded the 8.3 Windows installation (binary with installer). My database uses tsearch2. I was about to follow the conversions instructions found at Appendix F31 (on the new tsearch module). http://www.postgresql.org/docs/8.3/static/tsearch2.html However, I hit a problem when I get to

Re: [GENERAL] ERROR: expected just one rule action

2008-02-10 Thread Tom Lane
Dave Livesay <[EMAIL PROTECTED]> writes: > I'm sure it has something to do with the complex build environment > and getting up to speed with the new tools. FWIW, I just verified that your queries work fine for me in CVS HEAD on a G4, under both 10.4 (building with Xcode 2.5) and 10.5 (building w

Re: [GENERAL] pg_restore seems slow

2008-02-10 Thread Willem Buitendyk
I did use the 'd' switch but I didn't use the 'C' switch so I'm not sure a database was actually created. Anyways, after I used the correct switches all work fast - really fast. About a 1M records per minute. I was able to peek into the server processes to see the current copy commands in ef

[GENERAL] Mechanics of Select

2008-02-10 Thread Willem Buitendyk
I have the following function that returns the first day of the next month from whatever date is inserted. If I use this as part of a select statement then it takes almost twice as long to perform. Is this because for each scanned record this function is being called? If so any ideas how I c

[GENERAL] copy question - fixed width?

2008-02-10 Thread Klint Gore
Is there any way to make copy work with fixed width files? eg create table t1 (code char(5), description char(30)); copy t1 from '/tmp/afile' delimiter as where afile looks something like 1test16789012345678901234567890 2test26789012345678901234567890 3test367890123456789012345678

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread brian
Willem Buitendyk wrote: I have the following function that returns the first day of the next month from whatever date is inserted. If I use this as part of a select statement then it takes almost twice as long to perform. Is this because for each scanned record this function is being called?

Re: [GENERAL] 8.3: where's the replacement tsearch2 module?

2008-02-10 Thread Chris
Pierre Thibaudeau wrote: I just downloaded the 8.3 Windows installation (binary with installer). My database uses tsearch2. I was about to follow the conversions instructions found at Appendix F31 (on the new tsearch module). http://www.postgresql.org/docs/8.3/static/tsearch2.html However, I h

Re: [GENERAL] copy question - fixed width?

2008-02-10 Thread Tom Lane
Klint Gore <[EMAIL PROTECTED]> writes: > Is there any way to make copy work with fixed width files? I'd suggest using a simple sed script to convert the data into the format COPY understands. regards, tom lane ---(end of broadcast)-

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread Tom Lane
Willem Buitendyk <[EMAIL PROTECTED]> writes: > I have the following function that returns the first day of the next > month from whatever date is inserted. If I use this as part of a select > statement then it takes almost twice as long to perform. Is this > because for each scanned record thi

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread Bill Moran
Willem Buitendyk <[EMAIL PROTECTED]> wrote: > > I have the following function that returns the first day of the next > month from whatever date is inserted. If I use this as part of a select > statement then it takes almost twice as long to perform. Is this > because for each scanned record th

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread Greg Smith
On Sun, 10 Feb 2008, Willem Buitendyk wrote: I have the following function that returns the first day of the next month from whatever date is inserted. See if you can do this with date_trunc instead to avoid calling a function, which avoids the whole thing. The first day of next month is:

Re: [GENERAL] Alter Temporary table in Stored Procedure

2008-02-10 Thread Tom Lane
"Nykolyn, Andrew" <[EMAIL PROTECTED]> writes: > I have the following code in my stored procedure: > create temporary table t_resultset as select * from > get_createtempmsg(); > alter table t_resultset add column seq serial; > The error I get is - relation "public.t_resultset" does no

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread Alban Hertroys
On Feb 11, 2008, at 12:43 AM, brian wrote: Try: CREATE OR REPLACE FUNCTION first_day_next_month(inputdate date) RETURNS date AS $BODY$ DECLARE resultdate date; BEGIN SELECT INTO resultdate to_date(to_char((inputdate + interval \ '1 month'), '-MM') || '-01', '-mm-dd');

Re: [GENERAL] 8.3: where's the replacement tsearch2 module?

2008-02-10 Thread Tom Lane
"Pierre Thibaudeau" <[EMAIL PROTECTED]> writes: > I am assuming that the "replacement tsearch2 module" is some file > "tsearch2.sql" found in the folder share/contrib. However, no such > file, or anything that looks remotely like it, in that folder or in > any folder around. Hmm, it's definitely

Re: [GENERAL] Mechanics of Select

2008-02-10 Thread Willem Buitendyk
As others have suggested my big problem with the function I wrote was that I had made it Volatile instead of Immutable (it is no doubt suffering from code bloat as well). That made all the difference. Curiously though - I tried it just with the date_trunc function and it was just as slow as my

Re: [GENERAL] 8.3: where's the replacement tsearch2 module?

2008-02-10 Thread Pierre Thibaudeau
> > My database uses tsearch2. I was about to follow the conversions > > instructions found at Appendix F31 (on the new tsearch module). > > http://www.postgresql.org/docs/8.3/static/tsearch2.html > The docs will need to be updated because tsearch2 is now in the core and > should already be availa

Re: [GENERAL] Kernel kills postgres process - help need

2008-02-10 Thread Alvaro Herrera
Hervé Piedvache escribió: > Another, may be stupid question, but when you have several web nodes like > me ... with several physical database (I'm not talking about replication, > it's just that the web node can contact 3 or 4 differents database for > differents applications), what is the best