Re: [GENERAL] Understanding VARHDRSZ

2006-07-26 Thread Tom Lane
"Redefined Horizons" <[EMAIL PROTECTED]> writes: > Page 524 of the PostgreSQL 8.1 Manual, PDF Edition, has a code snippit > that makes use of the VARHDRSZ macro. I'm trying to understand the > purpose of this macro. It's just a symbol for the size of the length word at the start of the stored valu

Re: [GENERAL] Problem with table slowing down - Help with EXPLAIN reqd

2006-07-26 Thread Q
On 27/07/2006, at 2:00 PM, Peter Watling wrote: I have a table with only 30 odd records... I use one field on each record as a sort of status, as a means of handshaking between a number of clients... It works OK in theory.. however, over time ( just days ) it gets progressively slower.. its as i

[GENERAL] Problem with table slowing down - Help with EXPLAIN reqd

2006-07-26 Thread Peter Watling
I have a table with only 30 odd records... I use one field on each record as a sort of status, as a means of handshaking between a number of clients... It works OK in theory.. however, over time ( just days ) it gets progressively slower.. its as if postgreSQL is keep a list of all updates... I tr

Re: [GENERAL] Performance Postgresql en HP-UX 11.x

2006-07-26 Thread Alvaro Herrera
[EMAIL PROTECTED] wrote: > > > tenemos instalado en la empresa postgresql en una PC 900mhz > con linux y 512 de ram y otro postgres en un > HP-UX con 1 gb de ram y con 2 procesadores de 470 mhz con > unix. > Hice correr una query en ambos equipos y la PC resolvio la > consulta hasta 3 vece

[GENERAL] Performance Postgresql en HP-UX 11.x

2006-07-26 Thread ing_enriquebarrios
tenemos instalado en la empresa postgresql en una PC 900mhz con linux y 512 de ram y otro postgres en un HP-UX con 1 gb de ram y con 2 procesadores de 470 mhz con unix. Hice correr una query en ambos equipos y la PC resolvio la consulta hasta 3 veces más rápido que el servidor. ¿Cúal puede se

Re: [GENERAL] Database corruption with Postgre 7.4.2 on FreeBSD 6.1?

2006-07-26 Thread Aaron Glenn
On 7/26/06, aurora <[EMAIL PROTECTED]> wrote: From your experience do you expect the database would run into this from time to time that requires DBA's interventions? Is so it would become a problem for our customers because our product is a standalone system. We don't intend to expose the Postg

Re: [GENERAL] CREATE DATABASE question.

2006-07-26 Thread Eric Faulhaber
Karen Hill wrote: > I have an sql file that doesn' t work properly when I do: psql < > mysql.sql . I cannot get it to connect to the database. > > Here what I'd like it to do: > > CREATE DATABASE testdb; > \c testdb; > CREATE TABLE tableTest(var varchar); > > But I get an error on the second li

Re: [GENERAL] Database corruption with Postgre 7.4.2 on FreeBSD 6.1?

2006-07-26 Thread aurora
From your experience do you expect the database would run into this from time to time that requires DBA's interventions? Is so it would become a problem for our customers because our product is a standalone system. We don't intend to expose the Postgre database underneath. wy Try doing a R

[GENERAL] CREATE DATABASE question.

2006-07-26 Thread Karen Hill
I have an sql file that doesn' t work properly when I do: psql < mysql.sql . I cannot get it to connect to the database. Here what I'd like it to do: CREATE DATABASE testdb; \c testdb; CREATE TABLE tableTest(var varchar); But I get an error on the second line about an invalid character. Is it

Re: [GENERAL] Database corruption with Postgre 7.4.2 on FreeBSD 6.1?

2006-07-26 Thread Shoaib Mir
Try doing a REINDEX and see if you can recover all data blocks as it appears to me you have some data blocks messed up. If possible try taking the backup for your database as well.Thanks,-- Shoaib Mir EnterpriseDB (www.enterprisedb.com)On 7/27/06, aurora <[EMAIL PROTECTED] > wrote:Hello,We are stre

[GENERAL] Understanding VARHDRSZ

2006-07-26 Thread Redefined Horizons
Page 524 of the PostgreSQL 8.1 Manual, PDF Edition, has a code snippit that makes use of the VARHDRSZ macro. I'm trying to understand the purpose of this macro. Here is the code from the manual: #include "postgres.h" ... char buffer[40]; /* our source data */ ... text *destination = (text *) pal

[GENERAL] Database corruption with Postgre 7.4.2 on FreeBSD 6.1?

2006-07-26 Thread aurora
Hello, We are stressing testing our application. It adds and deletes a lot of rows. Within 24 hours we ran into some sort of database corruption problem. We got this error when trying to insert into the users table. ERROR XX001: invalid page header in block 2552 of relation "users_name_l

Re: [GENERAL] Table Inheritence...Just Columns?

2006-07-26 Thread Shoaib Mir
>From PostgreSQL 8.1 documentation (http://www.postgresql.org/docs/8.1/static/ddl-inherit.html)"Check constraints can be defined on tables within an inheritance hierarchy. All check constraints on a parent table are automatically inherited by all of its children. Other types of constraints are not

Re: [GENERAL] Generating unique session ids

2006-07-26 Thread Tom Lane
"Antimon" <[EMAIL PROTECTED]> writes: > As the id field is primary key, it should generate a unique violation > if duplicate ids created, might be seen rarely but wanted to solve it > anyway. Why don't you just use a serial generator? So i decided to check it by changing "sid := md5(random());"

[GENERAL] Generating unique session ids

2006-07-26 Thread Antimon
Hi, I need to generate sessions for logged in users to my website which uses pgsql. So i decided to write a function which is this: --- CREATE OR REPLACE FUNCTION session_createsession(int4, "varchar") RETURNS text AS $BODY$ DECLARE sid TEXT; BEGIN sid :

Re: [GENERAL] What's special about 1916-10-01 02:25:20? Odd jump in internal timestamptz representation

2006-07-26 Thread Tom Lane
"Alistair Bayley" <[EMAIL PROTECTED]> writes: > The first line of output puzzles me: why is '1916-10-01 02:25:20' > 2627158159 seconds before 2000-01-01, while '1916-10-01 02:25:21' is > 2627156080 before; a difference of 2080 seconds, or 34m:40s. What timezone are you testing in? Perusing the zi

[GENERAL] What's special about 1916-10-01 02:25:20? Odd jump in internal timestamptz representation

2006-07-26 Thread Alistair Bayley
(forwarded from pgsql-interfaces because no response there; can anybody tell me if I really have a bug, or am just a bit dim?) Hello, Below is a test C program, which fetches some timestamp literals and prints their internal representation, which is the number of seconds after 2000-01-01, stored

[GENERAL] Table Inheritence...Just Columns?

2006-07-26 Thread Redefined Horizons
Does a child table just inherit the columns from a parent table, or are other table objects like column constraints and triggers inherited? Thanks, Scott Huey ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an approp

Re: [GENERAL] copy losing information

2006-07-26 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Silvela, Jaime (Exchange) wrote: >> No lines contain quotes. And the same file will sometimes be fully >> imported, and sometimes lose data. I'm thinking that under heavy loads, >> the database is discarding INSERTS. > I don't think that's very likely.

Re: [GENERAL] copy losing information

2006-07-26 Thread Reece Hart
On Wed, 2006-07-26 at 12:48 -0400, Silvela, Jaime (Exchange) wrote: This is the first time I post to the list. I’ve done a brief search and didn’t find my issue treated already, so here it goes. Apologies if this has been reported before. What PG version and environment?  How about sendi

Re: [GENERAL] copy losing information

2006-07-26 Thread Alvaro Herrera
Silvela, Jaime (Exchange) wrote: > No lines contain quotes. And the same file will sometimes be fully > imported, and sometimes lose data. I'm thinking that under heavy loads, > the database is discarding INSERTS. I don't think that's very likely. How are you checking that the data is there? Do

Re: [GENERAL] Database Design Theory - PostgreSQL Custom Types

2006-07-26 Thread Martijn van Oosterhout
On Wed, Jul 26, 2006 at 11:09:22AM -0700, Redefined Horizons wrote: > I'm trying to come up with some good rules of thumb that can help me > determine when it is practical to implement a custom type on > PostgreSQL. To me a custom datatype is useful when there is a set of values where you have ope

Re: [GENERAL] copy losing information

2006-07-26 Thread Silvela, Jaime \(Exchange\)
No lines contain quotes. And the same file will sometimes be fully imported, and sometimes lose data. I'm thinking that under heavy loads, the database is discarding INSERTS. thanks -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 26, 2006 4:14 PM To: Sil

Re: [GENERAL] copy losing information

2006-07-26 Thread Tom Lane
"Silvela, Jaime \(Exchange\)" <[EMAIL PROTECTED]> writes: > I've started to notice missing info sometimes. I'll truncate the table, > read from the file, and notice that sometimes there are less rows in the > table than in the file. Have you made any attempt to determine *which* rows are missing?

[GENERAL] copy losing information

2006-07-26 Thread Silvela, Jaime \(Exchange\)
This is the first time I post to the list. I’ve done a brief search and didn’t find my issue treated already, so here it goes. Apologies if this has been reported before.   I have a pretty big file, around 2 million rows, in tab-separated format, with 4 columns, that I read into a table i

[GENERAL] Database Design Theory - PostgreSQL Custom Types

2006-07-26 Thread Redefined Horizons
Merlin has helped me understand custom data types in PostgreSQL a lot better, but I have some more questions I was hoping the list might be able to help with. I'm trying to come up with some good rules of thumb that can help me determine when it is practical to implement a custom type on PostgreS

Re: [GENERAL] Database Restore errors

2006-07-26 Thread Woody Woodring
I am running into this issue as well.  I am upgrading from 7.4.X to 8.1.4.  My databases were "ASCII" encoded in 7.4.X   I am editing the dumps to remove the non-UTF8 characters, but you could also create your new db with "ASCII" encoding and it should import fine.   Hope this helps,   Woody

Re: [GENERAL] wrong timestamp

2006-07-26 Thread Michael Fuhr
On Tue, Jul 25, 2006 at 05:54:00PM +0400, xyzyx wrote: > I use Postgresql 8.1.4 on Debian, > when I run command 'select current timestamp' or 'select now' in > pgAdmin, I everytime get "2000-01-01 03:02:16.105976+03". > When I run 'select TIMEOFDAY()' I get right time. Are you getting the actual

Re: [GENERAL] Mapping/DB Migration tool

2006-07-26 Thread Reece Hart
On Wed, 2006-07-26 at 15:18 +0200, Karsten Hilbert wrote: > > For some kinds of changes, and especially those that make > destructive > > in-place changes that might require debugging, I've written views > which > > generate the SQL statements to execute. > Would you mind giving a small example ? T

Re: [GENERAL] Constraint on an aggregate? (need help writing trigger,

2006-07-26 Thread Kenneth Downs
Isak Hansen wrote: Each entry in 'A' belongs to a single 'business event'. E.g. registering a phone bill modifies your accounts payable, phone expenses and vat paid accounts. Those transactions better balance out. There's no 'A' table in the system we base ours on, you'd just have X lines with

Re: [GENERAL] loop with circular updates

2006-07-26 Thread Kenneth Downs
Jessica M Salmon wrote: Hi All. I'm writing a plpgsql function that creates a table and loops over the items in that table, using a FOR ... IN EXECUTE ... loop. The thing is, on each iteration I update the table over which I am looping. Sometimes, the result of this update makes it no longer ne

[GENERAL] wrong timestamp

2006-07-26 Thread xyzyx
Hello, I use Postgresql 8.1.4 on Debian, when I run command 'select current timestamp' or 'select now' in pgAdmin, I everytime get "2000-01-01 03:02:16.105976+03". When I run 'select TIMEOFDAY()' I get right time. Whats wrong? -- xyzyx. ---(end of broadcast)---

Re: [GENERAL] "Ghost" colmumn with primary key

2006-07-26 Thread chris997
Yes, you were right, adding "" solved the problem many thanx! ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

[GENERAL] Error using OLD and NEW records

2006-07-26 Thread Germán Hüttemann Arza
Hi, I'm writting because I get an error when I try to use OLD and NEW records in a trigger procedure. The exact error messages were: NEW used in quere that is not in a rule PL/pgSQL function "audit_persona" line 6 at SQL statement OLD used in quere that is not in a rule PL/pgSQL

[GENERAL] loop with circular updates

2006-07-26 Thread Jessica M Salmon
Hi All. I'm writing a plpgsql function that creates a table and loops over the items in that table, using a FOR ... IN EXECUTE ... loop. The thing is, on each iteration I update the table over which I am looping. Sometimes, the result of this update makes it no longer necessary/desirable to proce

[GENERAL] Database Restore errors

2006-07-26 Thread Tom Kinard
I am attempting to restore a database. When I run pg_restore I get the following error: Pg_restore:  [archiver (db)] error returened by PQendcopy: ERROR: invalid byte sequence for encoding “UTF8” : 0x92 The dump was generated on a Mac and I am doing a restore on a Fedora Core 4 box. The

Re: [GENERAL] sequences vs oids as primary keys

2006-07-26 Thread Merlin Moncure
On 7/25/06, Kenneth Downs <[EMAIL PROTECTED]> wrote: craigp wrote: >1) does it make sense (and would it be possible) to make a rule which would, >say, somehow write into the oid field of a tuple to be returned by lastoid? i'm >assuming here that the database would not have oid's enabled. > > > W

Re: [GENERAL] Constraint on an aggregate? (need help writing trigger,

2006-07-26 Thread Kenneth Downs
Isak Hansen wrote: Hello Isak! I was speaking to you about this on comp.databases, glad to see you here on the Postgres group. What you want to do is easy enough in the single case, but can get complicated if you do a lot of it. We have a framework that is freely available that does exact

Re: [GENERAL] ECPG. Badly stuck

2006-07-26 Thread Michael Meskes
On Tue, Jul 25, 2006 at 02:46:02PM -0400, Jasbinder Bali wrote: > Forget about cursors. Singleton queries are also not working. Great statement. > Tried writing the follwoing code but doesn't give me any result. > Don't know if i have to do somethin else apart from what i've already done. How a

Re: [GENERAL] ECPG. Badly stuck

2006-07-26 Thread Joachim Wieland
On Tue, Jul 25, 2006 at 02:46:02PM -0400, Jasbinder Bali wrote: > Tried writing the follwoing code but doesn't give me any result. > Don't know if i have to do somethin else apart from what i've already done. There are many ways your program can fail before actually reaching the select line but yo

[GENERAL] Constraint on an aggregate? (need help writing trigger, i think..)

2006-07-26 Thread Isak Hansen
I have the following two tables: create table a ( id serial primary key, ); create table b ( id serial primary key, a_id int4 references a (id), amount decimal(16, 2) ); and would like a constraint to guarantee that "sum(b.amount) = 0 group by b.a_id". From my testing so far, and this thr