[GENERAL] Large Files?

2001-10-17 Thread Andrew Crouch



[postres@kc131-161 /usr/local/opt/Postgres/data/global]# ls -la
total 170
drwx--  2 postgres  dbadmin 512 Oct 15 18:09 .
drwx--  5 postgres  dbadmin 512 Oct 15 18:00 ..
-rw---  1 postgres  dbadmin8192 Oct 15 18:10 1260
-rw---  1 postgres  dbadmin   0 Oct 15 17:59 1261
-rw---  1 postgres  dbadmin8192 Oct 18 13:00 1262
-rw---  1 postgres  dbadmin   0 Oct 15 17:59 1264
-rw---  1 postgres  dbadmin  122880 Oct 18 13:28 1269
-rw---  1 postgres  dbadmin8192 Oct 15 17:59 17127
-rw---  1 postgres  dbadmin8192 Oct 15 17:59 17130
-rw---  1 postgres  dbadmin8192 Oct 18 13:28 pg_control
-rw---  1 postgres  dbadmin   0 Oct 15 18:09 pg_pwd
-rw---  1 postgres  dbadmin   0 Oct 15 18:08 pg_pwd.reload


-rw---  1 postgres  dbadmin  122880 Oct 18 13:28 1269   -- What is this
file


Im running a fairly heavy database application, this file grew in size to

-rw--- 1 postgres dbadmin 961904640 Oct 15 16:18 1269

over a period of 2-3 months?


Failing everything, I backed up the database, upgraded postgres and reloaded
the database only to see this file popup again.  Can i safely delete this
file? What is it? Do i need it ?

Regards
Andrew


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] SQL equivallent to \ds in psql

2001-10-17 Thread Brett W. McCoy

On 17 Oct 2001, Arcady Genkin wrote:

 What I want is an SQL equivallent of \ds command, which will return
 a list of all sequences in the current database.  I need this for a
 periodically run script so that I could keep an eye on all sequences
 in the database.

\ds *is* the psql command for listing sequences:

arc= create sequence testme;
CREATE
arc= \ds
   List of relations
  Name  |   Type   |   Owner
+--+---
 testme | sequence | arc_admin
(1 row)

-- Brett
  http://www.chapelperilous.net/

Thrashing is just virtual crashing.


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [GENERAL] SQL equivallent to \ds in psql

2001-10-17 Thread Brett W. McCoy

On 17 Oct 2001, Arcady Genkin wrote:

 Where does Postgres store information about the sequences?  I tried
 looking in the tables produced by \dS, but could find no references
 to the sequences. :(

Oops, I thought you had made a typo, but I made a thinko.  Use the -E
option to generate the SQL to pull out sequences:

arc= create sequence testme;
CREATE
arc= \ds
* QUERY *
SELECT c.relname as Name,
  (CASE WHEN relkind = 'S' THEN 'sequence'::text ELSE 'index'::text END)
as Type,
  u.usename as Owner
FROM pg_class c, pg_user u
WHERE c.relowner = u.usesysid AND relkind in ('S')
  AND c.relname !~ '^pg_'
UNION
SELECT c.relname as Name,
  (CASE WHEN relkind = 'S' THEN 'sequence'::text ELSE 'index'::text END)
as Type,
  NULL as Owner
FROM pg_class c
WHERE not exists (select 1 from pg_user where usesysid = c.relowner) AND
relkind in ('S')
  AND c.relname !~ '^pg_'

ORDER BY Name
*

   List of relations
  Name  |   Type   |   Owner
+--+---
 testme | sequence | arc_admin
(1 row)

-- Brett
  http://www.chapelperilous.net/

Sometime when you least expect it, Love will tap you on the shoulder...
and ask you to move out of the way because it still isn't your turn.
-- N.V. Plyter


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] Python interface memory leak?

2001-10-17 Thread Denis Gasparin

At 16/10/01 14.00, you wrote:
Does the python interface leak memory? We are seeing the process grow
with basically every select. Any suggestions on what's going on? There
are no cycles, and a trivial program (basically a loop around a select)
demonstrates the problem.

This is 7.1.2 on RH7.[01].

 Stephen

The python interface stores query datas in memory. If you don't clean such 
datas, the used memory will grow up...

If this is not the case, try the PoPy postgres driver for Python 
(http://popy.sourgeforge.net or 
http://freshmeat.net/redir/popy/8258/url_tgz/PoPy-2.0.7.tar.gz ).

Regards,



Doct. Eng. Denis 
Gasparin [EMAIL PROTECTED]
---
Programmer  System 
Administratorhttp://www.edistar.com
---
  Well alas we've seen it all before
   Knights in armour, days of yore
  The same old fears and the same old crimes
We haven't changed since ancient times

   -- Iron Hand -- Dire Straits --
---


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] Python interface memory leak?

2001-10-17 Thread Stephen Robert Norris

On Wed, 2001-10-17 at 16:56, Denis Gasparin wrote:
 At 16/10/01 14.00, you wrote:
 Does the python interface leak memory? We are seeing the process grow
 with basically every select. Any suggestions on what's going on? There
 are no cycles, and a trivial program (basically a loop around a select)
 demonstrates the problem.
 
 This is 7.1.2 on RH7.[01].
 
  Stephen
 
 The python interface stores query datas in memory. If you don't clean such 
 datas, the used memory will grow up...

Actually, it's a bug. I spent most of today with a co-worker looking for
it. There's a Py_DECREF missing in the fetch routine, which makes it
leak the results of every fetch. Who do I send the (one-line) fix to?

Stephen



msg28184/pgp0.pgp
Description: PGP signature


[GENERAL] Blank SQL insert statements

2001-10-17 Thread Ashley @ Turton

I am developing a system to take a generic data structure and store it in a
PostgreSQL database.  The data structure contains several entries of the
following:

insert a record into table1
field1  value1
field2  value2

insert a record into table2
field1  value1
field2  value2

Data for different tables is stored in each 'data set'.  When I get this to
the database I want to:

insert a blank record into tablex
populate fieldx of new record with valuex

I could implement this with some if statements based on the table name, then
INSERT INTO x (...) VALUES (...), but I would prefer to kept the structure
as generic as possible.  Is it possible in PostgreSQL to construct a blank
record without specifying a list of fields and values in an INSERT statement
(so I can perform a collection for UPDATEs to populate the blank record)?


Ashley


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [GENERAL] Python interface memory leak?

2001-10-17 Thread Tom Lane

Stephen Robert Norris [EMAIL PROTECTED] writes:
 Actually, it's a bug. I spent most of today with a co-worker looking for
 it. There's a Py_DECREF missing in the fetch routine, which makes it
 leak the results of every fetch. Who do I send the (one-line) fix to?

pgsql-patches list.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] postgresql 7.1.3

2001-10-17 Thread Trond Eivind Glomsrød

Lamar Owen [EMAIL PROTECTED] writes:

 On Tuesday 16 October 2001 02:39 pm, samsom, debra wrote:
  I just installed postgresql 7.1.3 on Linux Redhat 7.1.  All is well except
  Postgresql will not start on Boot.  I have added the -o '-i' to the
  postgresql.conf and done the chkconfig --add postgresql.  Is there anything
  else that I am missing?
 
 My apologies.  In my README.rpm-dist I missed a step: 
 chkconfig --level 345 postgresql on

You don't need the levels if you don't want to e.g. have it only start
in runlevel 5...

chkconfig postgresql on

is sufficient for most use.

-- 
Trond Eivind Glomsrød
Red Hat, Inc.

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



[GENERAL] C++ Examples

2001-10-17 Thread Mayan

I've been looking for examples of how to access the back end of
PostgreSQL using the C++ library, but all I've found is 'C' examples.
Can someone point point out where I can get living and breathing
examples of C++.

TIA

--
My Computer's Opinion
~~

if( desire == play_games() ){return getNintendo64();}
if( (desire == computing() )  (user != smart) )
{return getMicrosoft();}
if( ( desire == computing() )  (user == smart) )
{return getLinux();}




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



[GENERAL] BLOB

2001-10-17 Thread Benny Marin

Hello,

Can someone tell me how to work with large objects ?

All I want to do is to store an image into my database and retrieve them
back.
What datatype do I have to use?

What is the sql statement to send a image to the database and how can I
retrieve it back.

I'm using php or VB.

Thanks



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] A tool for making console/text data enrty/display screens in C

2001-10-17 Thread David. E. Goble

On Sat, 13 Oct 2001 17:26:49 +1300, Andrej Falout [EMAIL PROTECTED]
wrote:

Aubit is much more then you asked for, but it will allow you to do this 
really easy, and result is C code. See my sig.

Hi Andrej;

Ok, I have downloaded the source tar.gz, I am running RedHat 6.2. What
do I now? Is there a rpm available yet?
--Regards   David. E. Goble 
 goble [AT] kin.net.au  
  http://www.kin.net.au/goble 
 Po Box 648 Kingscote, Kangaroo Island, SA 5223

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[GENERAL] To Postgres Devs : Wouldn't changing the select limit syntax ....

2001-10-17 Thread Flancer

Break the SQL code that has been implemented for prior versions??
 Bummer ;((.

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] URGENT: Index problems

2001-10-17 Thread Steve Brett

I added a hash index to a varchar value and when i vacuumed i got the
following error:

 Index customer_ha_hash: NUMBER OF INDEX' TUPLES (9176) IS NOT THE SAME AS
HEAP' (9181).

dropping and recreating the index gave me the same error (on this index
only)

dropping the database and reimporting the data and then recreating the index
and vacuuming gave me the same error.

any ideas ? ... and does anyone know what the error means ?

thanks in advance.

Steve



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [GENERAL] URGENT: Index problems - update - please help ....

2001-10-17 Thread Steve Brett

okay.
i followed the instructions very carefully and get the following error when
i try to run pg_upgrade ..

Cannot find database template1 in ./data/base.
Are you running ./pg_upgrade as the postgres superuser?

i am running as superuser and template1 is not there.


Steve

Steve Brett [EMAIL PROTECTED] wrote in message
9qjgpp$3h3$[EMAIL PROTECTED]">news:9qjgpp$3h3$[EMAIL PROTECTED]...
 I added a hash index to a varchar value and when i vacuumed i got the
 following error:

  Index customer_ha_hash: NUMBER OF INDEX' TUPLES (9176) IS NOT THE SAME AS
 HEAP' (9181).

 dropping and recreating the index gave me the same error (on this index
 only)

 dropping the database and reimporting the data and then recreating the
index
 and vacuuming gave me the same error.

 any ideas ? ... and does anyone know what the error means ?

 thanks in advance.

 Steve





---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Dynamically created tables [WAS Re: [GENERAL] Relation x does not exist ...

2001-10-17 Thread Gaurav Priyolkar

On Tue, Oct 16, 2001 at 01:22:45AM -0700, Randal L. Schwartz wrote:
  Gaurav == Gaurav Priyolkar [EMAIL PROTECTED] writes:
 
 Gaurav Not feasible, because some functions have dynamically created
 Gaurav tables so I need to re-create table at each invocation.
 
 When I hear that, I always think bad design.

Perhaps there is a better way, but let me explain what I need to do.
A (temporary) table, say B, has to be created which is basically a
vertical representation of a number rows of another table, A. The data
in rows of A is interpreted differently depending on which one of a
number of groups that record belongs to, which is decided by certain
attributes which are ids.

So, a row in B is actually a number of rows from A, with the item in
each column of B corresponding to the data in one of the said rows of A.

I will try to give an example to be a little more clear: (please note
this is purely for the sake of description)
Consider A to be a table having rows with fields: city_id,  month_id
and temperature. 
So B will be a table with columns city_id and a number of columns for
months. A row of B will then be the temperatures measured over a
number of months.

Now, reason for all of the above: 
Apparently, when creating a Delphi report, it has to be fed with data
from a database table with exactly the columns as they are to appear
on the report. I am just meeting the specified requirement.

However, is there a better way.

Disclaimer:
Yes, I am not a Delphi programmer either.

 If the answer is dynamically created tables, I think you asked the
 wrong question to begin with.

Sorry, I have amended my subject line as you suggested.
I had used the error message for subject thinking someone might find
it familiar and be able to help. 

 It's a bit like saying I need to invent a new language for every book
 I write.  Uh, probably not. :)

Hey, Programming Perl has gone an edition ahead of Learning Perl
... when are we going to see the Third Edition of the 'Llama book'?
No new languages til then :)

Regards,
Gaurav 








---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [GENERAL] User privileges on sequences

2001-10-17 Thread Peter Eisentraut

Mihai Gheorghiu writes:

 Therefore, I have to give users permissions to sequences, just to the
 extent that they could add records. What is the minimum set of
 privileges for this?

You need UPDATE privileges to be able to execute nextval() and currval().
I assume this would include setval() as well, though I don't see it in the
docs offhand.

-- 
Peter Eisentraut   [EMAIL PROTECTED]   http://funkturm.homeip.net/~peter


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] To Postgres Devs : Wouldn't changing the select limit

2001-10-17 Thread Peter Eisentraut

Bruce Momjian writes:

  Break the SQL code that has been implemented for prior versions??
   Bummer ;((.

 Yes, but we don't follow the MySQL behavior, which we copied when we
 added LIMIT.  Seems we should agree with their implementation.

Isn't it much worse to not follow PostgreSQL behaviour than to not follow
MySQL behaviour?

-- 
Peter Eisentraut   [EMAIL PROTECTED]   http://funkturm.homeip.net/~peter



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] Blank SQL insert statements

2001-10-17 Thread Peter Eisentraut

Ashley @ Turton writes:

 Is it possible in PostgreSQL to construct a blank record without
 specifying a list of fields and values in an INSERT statement (so I
 can perform a collection for UPDATEs to populate the blank record)?

INSERT INTO tablename DEFAULT VALUES;

(The default values are going to be NULL unless you specified something
else when you created the table.)

-- 
Peter Eisentraut   [EMAIL PROTECTED]   http://funkturm.homeip.net/~peter


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [GENERAL] SQL equivallent to \ds in psql

2001-10-17 Thread Mitch Vincent

Use  psql -E and it will give you the SQL for the backslash commands.. 

-Mitch

- Original Message - 
From: Arcady Genkin [EMAIL PROTECTED]
To: PostgreSQL [EMAIL PROTECTED]
Sent: Wednesday, October 17, 2001 4:35 PM
Subject: [GENERAL] SQL equivallent to \ds in psql


 Where does Postgres store information about the sequences?  I tried
 looking in the tables produced by \dS, but could find no references
 to the sequences. :(
 
 What I want is an SQL equivallent of \ds command, which will return
 a list of all sequences in the current database.  I need this for a
 periodically run script so that I could keep an eye on all sequences
 in the database.
 
 Many thanks,
 -- 
 Arcady Genkin
 
 ---(end of broadcast)---
 TIP 5: Have you checked our extensive FAQ?
 
 http://www.postgresql.org/users-lounge/docs/faq.html
 


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] URGENT: Index problems

2001-10-17 Thread Steve Brett

apparently this is the fix:

psql -d mydb -c select * from title;  before
 # Save for after cmp test...
cd /usr/local/pgsql  # my install root...
vacuumdb mydb# clean up before moving...
cp -pr data data.backup  # make a backup...
pg_dumpall -s  schema.sql   # dump schema w/out data...
killall postmaster   # stop the server...
sleep 3
mv data data.old # set it aside...
cd /usr/src/pgsql/src# to the src tree...
gmake install# reinstall binaries...
cd /usr/local/pgsql  # back to my install root...
initdb   # recreate template1, sys
stuff...
postmaster -i -o -F -S 4096 -s  log # restart server...
sleep 3
pg_upgrade -f schema.sql data  upgrade.log # reload schema...
cp -p data.old/base/mydb/* data/base/mydb/   # replace data...
psql -d mydb -c select * from title;  after
 # verify we still have data...
diff before after# quick sanity check...

will let you know if it works ...
Steve Brett [EMAIL PROTECTED] wrote in message
9qjgpp$3h3$[EMAIL PROTECTED]">news:9qjgpp$3h3$[EMAIL PROTECTED]...
 I added a hash index to a varchar value and when i vacuumed i got the
 following error:

  Index customer_ha_hash: NUMBER OF INDEX' TUPLES (9176) IS NOT THE SAME AS
 HEAP' (9181).

 dropping and recreating the index gave me the same error (on this index
 only)

 dropping the database and reimporting the data and then recreating the
index
 and vacuuming gave me the same error.

 any ideas ? ... and does anyone know what the error means ?

 thanks in advance.

 Steve





---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])