Re: [GENERAL] Serial Vs Sequence

2011-01-31 Thread John R Pierce
On 01/31/11 10:55 PM, Adarsh Sharma wrote: Dear all, I am not able to distinct these two datatypes ( Serial and Sequence ) in Postgresql which resembles like auto-increment in Mysql. Which one gets priority and When ? The only thing I am able to find is to use SERIAL because if a drop table

Re: [GENERAL] Serial Vs Sequence

2011-01-31 Thread Pavel Stehule
Hello SEQUENCE isn't datatype. It is a database object. Simple object, that can to generate unique integer numbers. SERIAL is a fictive datatype. It can create a own SEQUENCE object and can create a reference on this object. pavel=# create sequence ; CREATE SEQUENCE Time: 461.883 ms pavel=#

[GENERAL] Serial Vs Sequence

2011-01-31 Thread Adarsh Sharma
Dear all, I am not able to distinct these two datatypes ( Serial and Sequence ) in Postgresql which resembles like auto-increment in Mysql. Which one gets priority and When ? The only thing I am able to find is to use SERIAL because if a drop table occurs , still SEQUENCE memory is not freed

[GENERAL] cast problem in Postgresql 9.0.1

2011-01-31 Thread AI Rumman
I migrated my DB from Postgresql 8.1 to Postgresql 9.0.1. I have a table "testtab" \d testtab id int, hours varchar When I execute the following: select sum(hours) from testtab I get cast error. Then, I created following IMPLICIT CAST functions in my DB => CREATE FUNCTION pg_catalog.integer(va

Re: [GENERAL] Automatic database monitoring tool for PostgreSQL ... new project

2011-01-31 Thread Joshua Tolley
On Mon, Jan 31, 2011 at 07:28:36PM +0100, Michael Justin wrote: > While I am still new to PostgreSQL and have real world experience with > DB2 InterBase and Firebird only I am interested to write a similar tool > for PostgreSQL. > > Maybe there are articles or discussions which help to get an

Re: [GENERAL] Why does my DB size differ between Production and DR? (Postgres 8.4)

2011-01-31 Thread Scott Marlowe
On Mon, Jan 31, 2011 at 5:54 PM, Aleksey Tsalolikhin wrote: > Situation:  Disk usage on production server root filesystem is at 68% > utilization (80 GB used), on DR is at 51% (56 GB used).   We use > SlonyII-1.2.x to keep the DR up to date.  I would like to account for > the 24 GB difference. Th

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 01:05, Tom Lane wrote: > Thom Brown writes: >> I've noticed that if I try to use generate_series to include the upper >> boundary of int4, it never returns: > > I'll bet it's testing "currval > bound" without considering the > possibility that incrementing currval caused an ove

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Tom Lane
Thom Brown writes: > I've noticed that if I try to use generate_series to include the upper > boundary of int4, it never returns: I'll bet it's testing "currval > bound" without considering the possibility that incrementing currval caused an overflow wraparound. We fixed a similar problem years a

[GENERAL] Why does my DB size differ between Production and DR? (Postgres 8.4)

2011-01-31 Thread Aleksey Tsalolikhin
Situation: Disk usage on production server root filesystem is at 68% utilization (80 GB used), on DR is at 51% (56 GB used). We use SlonyII-1.2.x to keep the DR up to date. I would like to account for the 24 GB difference. Symptoms: 1. Database size reported by psql c '\l+' Produc

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:41, Thom Brown wrote: > On 1 February 2011 00:36, Tom Lane wrote: >> Thom Brown writes: >>> Actually, those lower bound errors aren't related to generate_series, >>> but I'd still like to know why -2147483648::int4 is out of range. >> >> :: binds tighter than - (and everyth

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:36, Tom Lane wrote: > Thom Brown writes: >> Actually, those lower bound errors aren't related to generate_series, >> but I'd still like to know why -2147483648::int4 is out of range. > > :: binds tighter than - (and everything else too).  Write > (-2147483648)::int4 instead.

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Tom Lane
Thom Brown writes: > Actually, those lower bound errors aren't related to generate_series, > but I'd still like to know why -2147483648::int4 is out of range. :: binds tighter than - (and everything else too). Write (-2147483648)::int4 instead. regards, tom lane -- Sen

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:15, Thom Brown wrote: > Hi, > > I've noticed that if I try to use generate_series to include the upper > boundary of int4, it never returns: > > SELECT x FROM generate_series(2147483643::int4, 2147483647::int4) AS a(x); > > But the same query with int8 returns instantly: > >

Re: [GENERAL] Almost full pg_xlog/

2011-01-31 Thread Adrian Klaver
On Monday, January 31, 2011 3:32:16 pm Jeff Ross wrote: > Hi, > > I started trying to setup streaming replication here at work the first > of December but I didn't actually succeed until today. Too many other > crises to attend to ;-) > > In the meantime, I now have 242 16MB files in pg_xlog/.

Re: [GENERAL] Almost full pg_xlog/

2011-01-31 Thread Jeff Ross
On 01/31/11 17:13, Tom Lane wrote: Jeff Ross writes: In the meantime, I now have 242 16MB files in pg_xlog/. The archive_status directory in pg_xlog/has a matching .done file for all but the most recent of those pg_xlog files. What have you got checkpoint_segments set to? I had wal_keep_s

[GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
Hi, I've noticed that if I try to use generate_series to include the upper boundary of int4, it never returns: SELECT x FROM generate_series(2147483643::int4, 2147483647::int4) AS a(x); But the same query with int8 returns instantly: SELECT x FROM generate_series(2147483643::int8, 2147483647::i

Re: [GENERAL] Almost full pg_xlog/

2011-01-31 Thread Tom Lane
Jeff Ross writes: > In the meantime, I now have 242 16MB files in pg_xlog/. The > archive_status directory in pg_xlog/has a matching .done file for all > but the most recent of those pg_xlog files. What have you got checkpoint_segments set to? > Am I correct in thinking that I can delete most

[GENERAL] Almost full pg_xlog/

2011-01-31 Thread Jeff Ross
Hi, I started trying to setup streaming replication here at work the first of December but I didn't actually succeed until today. Too many other crises to attend to ;-) In the meantime, I now have 242 16MB files in pg_xlog/. The archive_status directory in pg_xlog/has a matching .done file

[GENERAL] PD_ALL_VISIBLE flag was incorrectly set in relation "pg_statistic"

2011-01-31 Thread bricklen
We just had a slew of the following messages in our log. How concerned should I be at this point? I have no idea what triggered it. Version: PostgreSQL 9.0.2 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit 2011-01-31 14:16:13 PST [32767]: [1-1] (u

Re: [GENERAL] Some Problems - Shall I reinstall the DB?

2011-01-31 Thread Adrian Klaver
On 01/31/2011 01:18 PM, vwu98...@lycos.com wrote: The DB connection problem has nothing to do with Hibernate. As I have said that the problem can be solved by restarting the DB. This problem occurs with my application as well as DdVisualizer. So know we know it is a generic connection problem.

Re: [GENERAL] Some Problems - Shall I reinstall the DB?

2011-01-31 Thread Adrian Klaver
On 01/31/2011 12:49 PM, vwu98...@lycos.com wrote: The 8.x version of PostgreSQL has been installed on my PC for quite few years. It has been problem free until recently. The first problem I have is that a connection can't be established after the PC just starts up although the DB is started. I

[GENERAL] Some Problems - Shall I reinstall the DB?

2011-01-31 Thread vwu98034
The 8.x version of PostgreSQL has been installed on my PC for quite few years. It has been problem free until recently. The first problem I have is that a connection can't be established after the PC just starts up although the DB is started. I have to restart it to solve this problem each time

Re: [GENERAL] Update existing system explicit cast to make it implicit

2011-01-31 Thread asia123321
"Tom Lane" napisał(a): > asia123...@op.pl writes: > > I am trying to use bit(1) datatype with existing application that used int > > datatype before. > > So I tried to create implicit cast that will allow me not to make code > > modifications and wanted to create implicit cast "int2bit", but it

Re: [GENERAL] Autovacuum Issues?

2011-01-31 Thread Kenneth Buckler
Well, that's good news and bad news. Good news...the application developers' jobs just got a little easier. Bad news...I get to document why we can't meet this security requirement. And yes, I agree, it's a pretty air-headed requirement. If I spent less time chasing compliance, I might actually

Re: [GENERAL] Update existing system explicit cast to make it implicit

2011-01-31 Thread asia123321
"Tom Lane" napisał(a): > asia123...@op.pl writes: > > I am trying to use bit(1) datatype with existing application that used int > > datatype before. > > So I tried to create implicit cast that will allow me not to make code > > modifications and wanted to create implicit cast "int2bit", b

Re: [GENERAL] Weird performance issue with custom function with a for loop.

2011-01-31 Thread Tom Lane
Nicos Panayides writes: > the following function takes forever to execute as is. I see 'Inserting > original actions in temporary table' and nothing after that. If i > replace orig_user_id in the FOR loop with 1811 (the same orig_user_id > passed as the function parameter) it returns immediatel

[GENERAL] Automatic database monitoring tool for PostgreSQL ... new project

2011-01-31 Thread Michael Justin
Hello, Two weeks ago I started a new open source software project (FireAlarm, http://sourceforge.net/projects/firealarm/) which helps to detect performance problems on Firebird SQL servers - by continuous analysis of system tables which are very similar to the PostgreSQL Statistics Views. W

[GENERAL] Weird performance issue with custom function with a for loop.

2011-01-31 Thread Nicos Panayides
Hello, the following function takes forever to execute as is. I see 'Inserting original actions in temporary table' and nothing after that. If i replace orig_user_id in the FOR loop with 1811 (the same orig_user_id passed as the function parameter) it returns immediately correctly (the table

Re: [GENERAL] Autovacuum Issues?

2011-01-31 Thread Tom Lane
Kenneth Buckler writes: > Does autovacuum automatically use the 'postgres' role? It automatically uses the bootstrap superuser role. > If so, how can I change what role autovacuum uses? You can't. > One of the security requirements > I've been required to implement removes superuser privileges

Re: [GENERAL] Adding more space, and a vacuum question.

2011-01-31 Thread Herouth Maoz
On 31/01/2011, at 03:49, Craig Ringer wrote: > For approaches to possibly fixing your problem, see: > > http://www.depesz.com/index.php/2010/10/17/reduce-bloat-of-table-without-longexclusive-locks/ > > http://blog.endpoint.com/2010/09/reducing-bloat-without-locking.html I'm not quite sure what

Re: [GENERAL] Create Table Question...

2011-01-31 Thread Tom Lane
Jerry LeVan writes: > Here is a fragment of sql that I frequently use: > * > insert into checks (select * >from dblink('select * from checks where date >=''1/1/2011''') >as (date date, >amount numeric(9,2), > tranid text, >source text, >memo text

Re: [GENERAL] Hit by the out of memory killer last night

2011-01-31 Thread Ben Chobot
On Jan 31, 2011, at 7:55 AM, Bryan Murphy wrote: > Last night we were hit by the out of memory killer. Looking at the following > graph, you can clearly see unusual memory growth. This is a database server > running Postgres 9.0.0. [snip] > Any advice? What should I be looking for? Any pa

Re: [GENERAL] Hit by the out of memory killer last night

2011-01-31 Thread Bryan Murphy
On Mon, Jan 31, 2011 at 10:35 AM, Ben Chobot wrote: > > Any advice? What should I be looking for? > > Any particular reason you are running the OOM killer on a database server? > Why have the kernel set to overcommit memory in the first place? Simply an oversight. That being said, it does not

[GENERAL] Hit by the out of memory killer last night

2011-01-31 Thread Bryan Murphy
Last night we were hit by the out of memory killer. Looking at the following graph, you can clearly see unusual memory growth. This is a database server running Postgres 9.0.0. http://mediafly-public.s3.amazonaws.com/dbcluster02-master-month.png We have another server, running Postgres 9.0.1 wh

[GENERAL] Create Table Question...

2011-01-31 Thread Jerry LeVan
The docs ( 9.0.2) for create table asserts that a data type representing a row of the table is automatically created. Tain't clear to me what this means... Here is a fragment of sql that I frequently use: * insert into checks (select * from dblink('select * from checks where date

[GENERAL] include source file from another language into function body?

2011-01-31 Thread Steve White
Hi, Is there an accepted way to load code in another language into a PostgreSQL function body? This would be really nice in several ways, for example: to run a code checker outside of postgresql, and to make things easier for source code colorizers. I have in mind something like ==

Re: [GENERAL] Update existing system explicit cast to make it implicit

2011-01-31 Thread Tom Lane
asia123...@op.pl writes: > I am trying to use bit(1) datatype with existing application that used int > datatype before. > So I tried to create implicit cast that will allow me not to make code > modifications and wanted to create implicit cast "int2bit", but it turned out > that there is alread

Re: [GENERAL] Postgresql-8.4.6, 64bit, Solaris 10u9, dtrace

2011-01-31 Thread dennis jenkins
On Fri, Jan 28, 2011 at 1:19 PM, dennis jenkins wrote: > Hello Everyone, > >    My goal is to install a 64-bit build of the latest Postgresql 8.4 > (not ready for 9.0 yet) onto a Solaris 10u9 server (Intel chips, > X4270), with dtrace support. > ".../no-dtrace-postgresql", untarred the build with

[GENERAL] out of shared memory - find temporary tables

2011-01-31 Thread Sabin Coanda
Hi there, I got "out of shared memory" error. Searching on postgresql forums, I found this it occurs probably because of intensive use of temporary tables in one transaction. I'm locking in pg_locks table, and I found some rows with the following modes: "ShareLock", "AccessExclusiveLock", "Exc

[GENERAL] Update existing system explicit cast to make it implicit

2011-01-31 Thread asia123321
Hi, I am trying to use bit(1) datatype with existing application that used int datatype before. So I tried to create implicit cast that will allow me not to make code modifications and wanted to create implicit cast "int2bit", but it turned out that there is already system cast. Unfortunately t

[GENERAL] Autovacuum Issues?

2011-01-31 Thread Kenneth Buckler
I'm seeing the following warning repeatedly in my postgres log. I'm using PostgreSQL 8.4 on RHEL6. Jan 29 04:49:57 myserver postgres[17308]: [3-1] user= db= host= WARNING: skipping "mytable" --- only table or database owner can vacuum it "mytable" is owned by a non-superuser role which cannot l

Re: [GENERAL] Adding more space, and a vacuum question.

2011-01-31 Thread Alban Hertroys
On 30 Jan 2011, at 17:14, Herouth Maoz wrote: > On 30/01/2011, at 12:27, Craig Ringer wrote: >> >> OK, so you're pre-8.4 , which means you have the max_fsm settings to play >> with. Have you seen any messages in the logs about the free space map (fsm)? >> If your install didn't have a big enoug