[GENERAL] Linux DBDesigner4 and PostgreSQL

2004-11-09 Thread Eric
I need help to connect DBDesigner4 linux in ODBC to postgres.

I'm having a problem connecting to a remote Postgres db using ODBC from
my Debian Linux laptop. I've got ODBC set up (UnixODBC). In DBDesigner
I'm simply trying to set up the connection using the ODBC datasource,
but I keep getting the following error message: 

Connection to database failed. 
Unable to Load libdbxoodbc.so 

Also, I would like to know if I use a model designer tool connected in
ODBC to postgres, will I have all postgres feature like if it was native
support?



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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Oliver Elphick
On Mon, 2004-11-08 at 17:47 -0700, Ed L. wrote:
 I often wonder why ipcs never seems to show the shared memory 
 block in question?

The permissions of the shared memory block and the semaphore arrays are
600.  ipcs seems not to report objects which you cannot access.  Run
ipcs as root and you should see the PostgreQSL shared memory segment and
semaphores.

-- 
Oliver Elphick  [EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
 
 O death, where is thy sting? O grave, where is 
  thy victory? 1 Corinthians 15:55 


---(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] Postresql RFD version 2.0 Help Wanted.

2004-11-09 Thread Martijn van Oosterhout
On Mon, Nov 08, 2004 at 12:55:06PM -0800, Mike Cox wrote:
 There is also the point of having to post.  If I post and I subscribe to the
 digest version or if I post with the option of no emails (since my inbox
 cannot handle the load), how would I respond to a thread I created?  Would
 I have to create a new thread for each response nameing the Subject with
 the previous one, and prefixing it with RE:?

Some mail readers allow you to insert the In-Reply-To: header, which
would make your posts match the previous thread. But it is irritating.
Besides, I like being able to see from the subject what a post is
about.

 A news reader is meant for the high amount of posts that many groups get. 
 An email inbox is not meant to have hundreds of emails weekly (or daily in
 the case of KLM).  Email is personal, so one knows that each messege is
 addressed to you and could be very important.  In usenet, one can choose to
 follow threads created by themselves or with browse, knowing that if they
 miss an article it won't be something that can have a personal consequence
 like email.

I must have missed the memo, I've been receiving hundreds of email per
week for quite a while now and it works for me. Obviously, I configured
my client to optimise for this. I have several views setup, one which
shows only personal email, one which only shows unread, etc. With
subsecond switching times between views, it makes handling large
amounts of email very efficicent.

I used to like usenet for handling really large volumes, but I couldn't
customise any clients to allow me to manage it efficiently.

Anyway, this whole debate is about making the current mail-news gateway
setup legitimate, so maybe we should get back to the issue at hand.
-- 
Martijn van Oosterhout   [EMAIL PROTECTED]   http://svana.org/kleptog/
 Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
 tool for doing 5% of the work and then sitting around waiting for someone
 else to do the other 95% so you can sue them.


pgpoexjzyUKld.pgp
Description: PGP signature


Re: [GENERAL] Per-Table Transaction Isolation Level?

2004-11-09 Thread Karsten Hilbert
 I'd like to know if there is a way to specify different transaction 
 isolation levels for different tables in the db.
Simply set up a connection for each transaction isolation level
you need and read the appropriate data from whichever
connection is suitable.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

---(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] Per-Table Transaction Isolation Level?

2004-11-09 Thread Martijn van Oosterhout
On Tue, Nov 09, 2004 at 04:34:16AM +0100, Florian G. Pflug wrote:
 My import sometimes crashed, becausse the meta-information tables are 
 changed while importing (e.h, I pass a id to a function, the function 
 does some calculations, than tries to select the row with the given id, 
 but fails, because the row was deleted in the meantime). I understand 
 that the standard approach to this problem is to set the transaction 
 isolation level to serializeable, thus avoiding non-repeatable reads.

I solved a problem similar to this by open two connections to the
database, one to do the readonly queries, one soley to import data. Also
had the nice feature that an error in one connection doesn't effect the
other.

Different connections could run at different isolation levels if
necessary.
-- 
Martijn van Oosterhout   [EMAIL PROTECTED]   http://svana.org/kleptog/
 Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
 tool for doing 5% of the work and then sitting around waiting for someone
 else to do the other 95% so you can sue them.


pgpOUYeL19r1q.pgp
Description: PGP signature


[GENERAL] Functions in postgres

2004-11-09 Thread Tk421



 I've made some functions, an i 
want these functions to be used by a specified user, but i don't want this user 
can see the code of the functions. Does somebody knows how can i do 
this?

 Sorry about my english, i'm 
spanish.
Víctor Robador Capel

Análisis de Sistemas y Programación

www.creativosdolmen.com


Re: [GENERAL] Functions in postgres

2004-11-09 Thread Peter Eisentraut
Am Dienstag, 9. November 2004 13:29 schrieb Tk421:
 I've made some functions, an i want these functions to be used by a
 specified user, but i don't want this user can see the code of the
 functions. Does somebody knows how can i do this?

The only way to do that would be to write the function in C and compile it 
into a shared library.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

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


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Ed L.
On Tuesday November 9 2004 2:16, Oliver Elphick wrote:
 On Mon, 2004-11-08 at 17:47 -0700, Ed L. wrote:
  I often wonder why ipcs never seems to show the shared memory
  block in question?

 The permissions of the shared memory block and the semaphore arrays are
 600.  ipcs seems not to report objects which you cannot access.  Run
 ipcs as root and you should see the PostgreQSL shared memory segment and
 semaphores.

I don't see them when running ipcs as root, either.  Not sure that would 
make sense given the shared memory is created as the same user running 
ipcs...

Ed



---(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] Functions in postgres

2004-11-09 Thread Michael Fuhr
On Tue, Nov 09, 2004 at 01:29:19PM +0100, Tk421 wrote:

 I've made some functions, an i want these functions to be used
 by a specified user, but i don't want this user can see the code
 of the functions.

Are you trying to hide the code itself, or are you just trying to
hide sensitive data embedded in the code?  If the latter, then you
might be able to move the data to a table and create the function
with SECURITY DEFINER.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[GENERAL] FW: Proper nesting of hierarchical objects

2004-11-09 Thread Garris, Nicole
We've actually implemented this kind of thing in a different DBMS. The
physical design consists of a single organization table that's something
like:

Org_key (primary key)
Org_type (group, company, etc.)
Org_level (group is 1, company is 2, etc.)
Org_parent_key (foreign key to org that encompasses this org; this is a
recursive relationship, i.e., a foreign key to the same table)
Org name, address, etc.

Advantages of this design:
- Its normalized, with the exception of org_level which could be derived by
counting how far down this organization is in the hierarchy
- Re-orgs are pretty easy, even promotions/demotions (level 3 becomes level
4, etc.)
- If a department moves to a different branch, its simply a matter of
changing the org_parent_key
- Easy to add another level below department (pretty common in my
organization)

My programmers hate it, but I'm not certain why. It seems easy to me to
create views that hide the recursion. There might be performance issues ...

Actually, a more flexible design has 2 tables. Table 1 is the org table:

Org_key (primary key)
Org_type
Org_level 
Org name, address, etc.

Table 2 is the org relationship table (see below). The primary key is
org_key + org_parent_key. 

Org_key
Org_parent_key
Relationship_type

Relationship type could be R for responsible to, B for budgets for,
etc., if organizations can have more than one hierarchy (yes it does happen
in ours).

Sorry if I didn't completely answer your question. Also, I don't know what
an adjacency list is.

-Original Message-
From: Michael Glaesemann [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 2:40 AM
To: '[EMAIL PROTECTED]' General
Subject: [GENERAL] Proper nesting of hierarchical objects

Hi all.

I'm working (well, rather, reworking) a database schema that, in part, 
models a company organizational structure. For example:

group
company
division
head office
department
department
branch
department
department
branch
department
department
division
company
division ...

I would like to model each node of this hierarchy as a generic org, 
as they will all share a lot of characteristics, such as each will have 
an address, phone numbers, email addresses (most departments have one 
email address rather than an email address for each person... but 
that's not my problem :). I'd prefer to model this with nested sets 
rather than an adjacency list for easy summaries, but either way, I'd 
like to make sure they nest properly, so I don't end up with companies 
as children of departments, for example.

What I've done so far is assign an org_type (e.g., group, company, 
division) to each org. My first thought was to assign each org_type a 
number, and set the numbers such that parents had numbers higher than 
children (or vice versa), and enforce that with triggers. One drawback 
was that I might want to use department as a catchall for anything 
relatively small, so a department could be a parent of another 
department. Enforcing this could be implemented by requiring the parent 
org_type number to be greater than or equal to the child org_type 
number, but that would also allow, for example, companies to nest in 
companies, which is undesirable.

My second thought was to set up a table that mapped allowable 
parent-child relations, and again, enforce immediate parent-child 
relationship validity using triggers. This is beginning to feel a bit 
hackish to me, so I thought I'd ask if anyone had some advice, words of 
encouragement, or pointers to where I might find information on 
modeling this.

Comments, suggestions, ideas, hints, criticism appreciated!

Regards,

Michael Glaesemann
grzm myrealbox com


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings

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

   http://archives.postgresql.org


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Oliver Elphick
On Tue, 2004-11-09 at 07:00 -0700, Ed L. wrote:
 On Tuesday November 9 2004 2:16, Oliver Elphick wrote:
  On Mon, 2004-11-08 at 17:47 -0700, Ed L. wrote:
   I often wonder why ipcs never seems to show the shared memory
   block in question?
 
  The permissions of the shared memory block and the semaphore arrays are
  600.  ipcs seems not to report objects which you cannot access.  Run
  ipcs as root and you should see the PostgreQSL shared memory segment and
  semaphores.
 
 I don't see them when running ipcs as root, either.  Not sure that would 
 make sense given the shared memory is created as the same user running 
 ipcs...

If neither root nor their creator can see them, I assume they don't
exist.  Certainly, with Linux 2.6 and util-linux 2.12, ipcs sees the
postgres objects whether it is run by root or by the postgres user.

-- 
Oliver Elphick  [EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
 
 O death, where is thy sting? O grave, where is 
  thy victory? 1 Corinthians 15:55 


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [GENERAL] INTERVAL in a function

2004-11-09 Thread Ron St-Pierre
Michael Fuhr wrote:
On Mon, Nov 08, 2004 at 04:15:34PM -0800, Ron St-Pierre wrote:
 

SELECT INTO exptime current_timestamp + INTERVAL ''intval'';
   

You're using the literal value 'intval' instead of its value, thus
the syntax error.  

Of course, I should have caught that.
You can simplify the statement to this:
exptime := current_timestamp + intval;
But I think the entire function can be shortened to:
CREATE OR REPLACE FUNCTION getUnitTimeLength(int) RETURNS TIMESTAMP AS '
SELECT CURRENT_TIMESTAMP::timestamp + unitTimeLength
FROM customer.groups
WHERE groupsID = $1
' LANGUAGE sql;
You don't need to check for NULL because the result of the addition
will already be NULL if either operand is NULL.  Casting CURRENT_TIMESTAMP
is necessary to avoid a return type mismatch error.
 

Perfect.
Thanks Michael!
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [GENERAL] Functions in postgres

2004-11-09 Thread Tk421
I want to hide the code itself

Víctor Robador Capel

Análisis de Sistemas y Programación

www.creativosdolmen.com
- Original Message - 
From: Michael Fuhr [EMAIL PROTECTED]
To: Tk421 [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, November 09, 2004 4:11 PM
Subject: Re: [GENERAL] Functions in postgres


 On Tue, Nov 09, 2004 at 01:29:19PM +0100, Tk421 wrote:

  I've made some functions, an i want these functions to be used
  by a specified user, but i don't want this user can see the code
  of the functions.

 Are you trying to hide the code itself, or are you just trying to
 hide sensitive data embedded in the code?  If the latter, then you
 might be able to move the data to a table and create the function
 with SECURITY DEFINER.

 -- 
 Michael Fuhr
 http://www.fuhr.org/~mfuhr/

 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings




---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [GENERAL] troubleshooting deadlocks

2004-11-09 Thread Tom Lane
Ed L. [EMAIL PROTECTED] writes:
 I know the original statement is printed right after this, but with complex 
 triggers doing lots of write queries, I'm finding it difficult to identify 
 which subsequent query in the trigger is really the one immediately 
 preceding the deadlock.  It would be helpful in debugging if the error 
 message included info on which tables are involved, maybe even the 
 deadlocking query itself, in the DETAIL output for future releases.  

I suppose the problem here has to do with conflicting SELECT FOR UPDATEs
from foreign-key references.  This does actually work nicely in CVS tip,
for non-deferred FKs:

regression=# select boo(2);
ERROR:  insert or update on table zork violates foreign key constraint 
zork_f1_fkey
DETAIL:  Key (f1)=(2) is not present in table zork2.
CONTEXT:  SQL statement insert into zork values( $1 )
PL/pgSQL function boo line 2 at SQL statement
regression=# 

For deferred FKs you're pretty much out of luck, because the original
statement is long gone by the time the FK trigger fires (and no, it's
not reasonable to keep a copy around).  The difficulty in making 7.4
do this is that in 7.4 AFTER triggers never fire within a user function,
so you're always dealing with the deferred situation.

regards, tom lane

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

   http://archives.postgresql.org


Re: [GENERAL] FTP mirror problems

2004-11-09 Thread Marc G. Fournier
On Sun, 7 Nov 2004, Greg Sabino Mullane wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
A bad link in the ftp source directory inspired me to check
the rest of it out:
* Main README file needs updating. The URL is given as:
http:/www.postgreSQL.org
but should be:
http://www.postgresql.org/
Huh?  Just checked, the file hasn't been modified since Nov 15th, 2001, 
and the URL looks fine to me:

svr1# grep http README
http://www.postgreSQL.org
svr1#
* README.cvsup is very old, possibly incorrect
have you tested this?  I last updated on Nov 3rd of this year, to reflect 
the reverting of the repository to overall state ... so if its incorrect, 
nobody has told me so ...

* README.dist-split might want to mention the new bz and md5 files.
If you would like to submit a re-write, I'll put it into place ... I think 
mentioning the bz files seperately would just bulk up the file ... ppl 
would see the .bz when they go to the directory itself ...

* We are keeping some very old versions around: 1.08, 1.09, the entire 6
series. Is there any reason for this? For that matter, is there any reason
to keep around lesser versions in a tree, especially ones that were replaced
due to security bugs? Perhaps only keep the latest few versions and put a
note in the readme to point to archives.postgresql.org or something?
At the very least, a warning that some of the versions on the site have
serious security flaws would be warranted.
Historical, but we could easily create a source/OLD directory to move them 
into, so they are less prominent?

* /dev/interfaces seems to have only an old version of libpqxx
* /dev/contrib only contains earthdistance - why?
removed both contrib and interfaces ... libpqxx is on gborg now, and 
earthdistances is back in the regular dev packages anyway ..

* /projects/gborg has some very old versions of some of the projects
therein. Is there a process to update these?
they are auto-updated from the gborg site, so that will have to be taken 
up with Chris ...

* The directory symlinked from /win32 should have a README. Perhaps
even a top-level README.WIN32 in anticipation of a lot of Windows users.
Please feel free to submit one for inclusion (or anyone else, for that 
matter ... I'm only picking you out since you are pointing them out 
*grin*) ...

* The /src directory is missing 7.2.6 and 7.3.6
fixed ...
* /src/7.3.5 points to the wrong place (missing a v)
fixed, and confirmed the rest were all link'd to the 'v' version ...
* /source/7.2.5/v7.2.5 is a bogus link
fixed ...
I went through and tested each of the ftp mirrors that appeared on the
page today. Some problems are probably transitory (e.g. timeouts) but
if anyone closer geographically (I'm in US) could test those, it would be
appreciated. No comment next to a mirror indicated that everything looked ok.
ftp4.ar
ftp.au
ftp2.au
ftp3.au: incorrect home directory
ftp.at
ftp.be
ftp.ba
ftp.br: connection refused
ftp2.br
ftp3.bg
ftp3.ca
ftp4.ca
ftp.cl
ftp.co
ftp2.cr
ftp.cz
ftp2.cz
ftp2.dk
ftp.ee
ftp.fr
ftp2.fr
ftp5.fr: connection refused
ftp.de
ftp2.de
ftp3.de
ftp7.de
ftp.gr
ftp2.gr
ftp.hk
ftp.hu: timeout + connection reset by peer
ftp3.hu
ftp2.is
ftp5.id: extra (old) dirs NT_Support_Files and CVSup
ftp7.id
ftp.ie
ftp2.ie
ftp2.il
ftp.it
ftp2.it
ftp5.it: connection refused
ftp6.it
ftp.jp
ftp.kr
ftp3.kr: has a :80 in the url; when removed, works fine
ftp.lv
ftp.nl: times out
ftp.eu (listed as Netherlands, but goes against the naming scheme)
ftp2.nl
ftp4.nl
ftp.nz
ftp.no
ftp6.pl
ftp7.pl
ftp8.pl
ftp.pt: wrong home directory; usually times out too
ftp.pr
ftp6.ro
ftp.ru
ftp2.ru: incorrect login error
ftp3.ru
ftp5.ru: times out
ftp2.sk: extra (old) dirs NT_Support_Files, CVSup, plus many version 
symlinks
ftp4.es: times out
ftp5.es
ftp.se
ftp2.ch
ftp.tw
ftp3.tw
ftp5.tw
ftp6.tr
ftp2.uk
ftp3.us
ftp5.us: times out
ftp8.us
ftp9.us
ftp10.us: has many bogus .message files throughout
ftp13.us
ftp21.us
ftp22.us
ftp23.us: incorrect login error
ftp24.us

Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


[GENERAL] ANN: PgBrowser 1.0

2004-11-09 Thread Jerry LeVan
PgBrowser is a postgresql database browser written in a more
or less platform independent fashion. I appears to work in
a Mac OSX environment, Linux, and Windows. The program is
written in Tcl/Tk. The program includes LJ Bayuk's Pgintcl
driver that is used if the Pgtcl 1.5 or greater driver cannot
be found. Thus no postgresql software need be present on
the users pc.
The homepage for PgBrowser is:
http://homepage.mac.com/levanj/TckTk
Feedback and enhancements are welcome.
Here are the enhancements from version 0.9:
Version 1.0 Enhancements (Nov 3 2004)
This version adds a number of enhancements.
o The ability to use psql (if present). If psql is found, psql 
meta-commands
	starting with a \ in the *first* character position are directly 
routed
	to psql for execution. The results are added to the SQL window. In 
addition
	if there is a selection in the SQL window, the menu item Send 
Selection To
	Psql under the File menu will send the selection to psql for 
execution. The
	results will be posted in the SQL window.
	Note: Arbitrary (output only) shell commands can be executed from the
		SQL window by the sequence \! shell command
		
o The File menu has an item Display null as NULL. When checked, 
null fields
	will be displayed in the grid as NULL otherwise null fields are 
displayed
	as empty strings. The check mark toggles with menu item selection.
	
o The File menu has an item Send Single Statements. When checked the 
program
	will attempt to parse the string being sent to the backend into 
individual
	statements and send each statement. If unchecked the entire string is
	sent to the backend in one shot. Note the parsing algorithm is rather 
crude.
	A semicolon is deemed to be a statement seperator if it not preceeded 
by
	an odd number of single quotes ( don't use \' use '' ). Checkmark is 
toggled
	by selection of the item.
	
o The File menu has an item Show Long Fields. When checked the 
program will
	attempt to load the entire field into the display grid. This can be
	problematic when the database contains bytea columns containing a large
	amount of data (think digital photos). If unchecked and the field 
length
	is more than 200 characters then then string LoNgFiElD:nnn will be
	displayed. The nnn will be replaced by the actual length of the 
field.
	See below for a method that will, in many cases, allow the user to see
	the actual contents of the field. The checkmark is toggled by selecting
	the item.
	
o There is a contextual menu available for the Selection Results grid. 
The
	menu is invoked by a control-Button-1 click somewhere in the grid.
	Selecting one of the menu items will control how the contents of the
	selected field will be displayed ( the selected field is where the
	mouse is when control-clicked). The field will be displayed in a 
separate
	window. This window must be dismissed before another item can be 
viewed.
	
	The menu items are:
		o View As Text
			The field is assumed to be plain text and the entire contents
			of the field will be displayed.
		o View As Bytea Text
			The field is assumed to be plain text stored as a bytea object.
			The entire contents will be decoded and displayed.
		o View As Large Object Text
			The field is assumed to be the oid of a large object containing
			text. The contents will be fetched and displayed.
		o View As Bytea Image
			The field is assumed to be an image stored in a bytea field.
			The image will displayed in a new window. Image means anything
			supported by the Img package.
		o View As Large Object Image
			The field is assumed to be the oid of a large object containing
			an image. The image will be fetched and displayed.
		o Export Bytea Field...
			The field is assumed to be a bytea field. The user will be able
			to specify and store the contents in a file.
		o Export Large Object Field...
			The field is assumed to be the oid of a large object. The user
			will be able to specify and store the contents in a file.
	
Enjoy,

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


[GENERAL] new data types

2004-11-09 Thread Alexander Cohen
When i write code in C to create the functions that define a new data 
type, how can i set a value so that the user sees a null value from 
sql.

thanks
Alex
---(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


[GENERAL] Vacuum hangs

2004-11-09 Thread Patrick Hatcher

PG: 7.4.5
RH 7.3
Vac_Mem=12mg

Doing a Vacuum Analyze on a table and
it's been hanging for at least 2 hours. I could see no other users
hitting the table at the time. This is the second time this has happened
on this particular table and I can't seem to pin point the issue. 
If I kill the PID and restart the vacuum analyze it works fine. Any
suggestion where I start searching? Here is an output from pg_stat_activity
and the 

mdc_oz=# select * from pg_stat_activity:
datid |
17145
datname| mdc_oz
procpid| 16560
usesysid   | 2
usename| phatcher
current_query | VACUUM ANALYZE cdm.cdm_reg_customer;
query_start  | 2004-11-09 10:02:32.523146-08


mdc_oz=# select * from pg_locks where
pid=16560;
-[ RECORD 1 ]-
relation  | 7059380
database  | 17145
transaction | 
pid | 16560
mode| ShareUpdateExclusiveLock
granted   | t
-[ RECORD 2 ]-
relation  | 
database  | 
transaction | 28863986
pid | 16560
mode| ExclusiveLock
granted   | t
-[ RECORD 3 ]-
relation  | 7059380
database  | 17145
transaction | 
pid | 16560
mode| ShareUpdateExclusiveLock
granted   | t

TIA

Patrick Hatcher

[GENERAL] Creating DB with pass, but pass not required to connect

2004-11-09 Thread Pablo Gosse
Hi folks.  I'm creating a database using the following command:

createdb -U pablo -W pablotest1

I'm prompted to enter the password to create the DB, and after doing so
the db is created successfully.

However, when I connect to this database via a php script, I can enter
any valid database user, and I can enter anything for the password (or
leave it blank), and I'm still able to connect.

So, each of these connection calls works:

$conn-Connect('localhost','pablo','realpass','pablotest1');
$conn-Connect('localhost','pablo','','pablotest1');
$conn-Connect('localhost','pablo','abc123','pablotest1');
$conn-Connect('localhost','bsc','notapass','pablotest1');
$conn-Connect('localhost','bsc','','pablotest1');

Obviously I'm doing something wrong here, since I don't want scripts to
be able to connect without the proper credentials.

Can anyone give me an idea if I'm executing the createdb command
incorrectly, or if something on the server level might be causing this?

Cheers and TIA,

Pablo

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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Vacuum hangs

2004-11-09 Thread Tom Lane
Patrick Hatcher [EMAIL PROTECTED] writes:
 Doing a Vacuum Analyze on a table and it's been hanging for at least 2 
 hours.  I could see no other users hitting the table at the time.  This is 
 the second time this has happened on this particular table and I can't 
 seem to pin point the issue.   If I kill the PID and restart the vacuum 
 analyze it works fine.  Any suggestion where I start searching?

Next time, please attach to the vacuuming backend with gdb and get a
stack trace.  The pg_locks output doesn't tell us anything except that
the problem isn't a lock :-(

regards, tom lane

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] Vacuum hangs

2004-11-09 Thread Patrick Hatcher




Will do thanks.  I ended up dropping and recreating the index and that
seems to have fixed the problem.


Patrick Hatcher



   
 Tom Lane  
 [EMAIL PROTECTED] 
 s To 
   Patrick Hatcher 
 11/09/2004 12:06  [EMAIL PROTECTED]
 PM cc 
   [EMAIL PROTECTED]
   Subject 
   Re: [GENERAL] Vacuum hangs  
   
   
   
   
   
   




Patrick Hatcher [EMAIL PROTECTED] writes:
 Doing a Vacuum Analyze on a table and it's been hanging for at least 2
 hours.  I could see no other users hitting the table at the time.  This
is
 the second time this has happened on this particular table and I can't
 seem to pin point the issue.   If I kill the PID and restart the vacuum
 analyze it works fine.  Any suggestion where I start searching?

Next time, please attach to the vacuuming backend with gdb and get a
stack trace.  The pg_locks output doesn't tell us anything except that
the problem isn't a lock :-(

 regards, tom lane



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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Greg Stark

Tom Lane [EMAIL PROTECTED] writes:

 Ed L. [EMAIL PROTECTED] writes:
  A power failure led to failed postmaster restart using 7.4.6 (see
  output below).  The short-term fix is usually to delete the pid file
  and restart.
 
 Thinking some more about this ... does anyone know the algorithm used
 in Linux to assign shared memory segment IDs?

At least in 2.6 it seems to avoid reuse of ids by keeping a global counter
that is incremented every time a segment is created which ranges from 0..128k
that it multiplies by 32k and adds to the array index (which is reused
quickly). 

So it doesn't seem plausible that there was an id collision unless this was
different in 2.4.20. However looking at his list of ids they're all separated
by multiples of 32769 which is what you would expect from this algorithm at
least until they start being reused.

-- 
greg


---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] troubleshooting deadlocks

2004-11-09 Thread Ed L.
On Tuesday November 9 2004 10:36, Tom Lane wrote:
 Ed L. [EMAIL PROTECTED] writes:
  I know the original statement is printed right after this, but with
  complex triggers doing lots of write queries, I'm finding it difficult
  to identify which subsequent query in the trigger is really the one
  immediately preceding the deadlock.  It would be helpful in debugging
  if the error message included info on which tables are involved, maybe
  even the deadlocking query itself, in the DETAIL output for future
  releases.

 I suppose the problem here has to do with conflicting SELECT FOR UPDATEs
 from foreign-key references.

That appears to be the issue.  We upgraded to 7.4.6 (thanks to slony, 
production downtime was minimal), then used 7.4.6 debug output to track 
relations, then guessed on fkey references, dropped them, and viola, no 
more deadlock.

Thanks,
Ed


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


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Greg Stark

Greg Stark [EMAIL PROTECTED] writes:

 At least in 2.6 it seems to avoid reuse of ids by keeping a global counter
 that is incremented every time a segment is created which ranges from 0..128k
 that it multiplies by 32k and adds to the array index (which is reused
 quickly). 
 
 So it doesn't seem plausible that there was an id collision unless this was
 different in 2.4.20. However looking at his list of ids they're all separated
 by multiples of 32769 which is what you would expect from this algorithm at
 least until they start being reused.

Oh I missed the fact that you were talking about after a reboot. So the
algorithm I described would produce exactly the same sequence of ids after any
reboot given the same sequence of creation and deletions. Even if there's a
different sequence as long as the n'th creation is for the m'th array slot it
would get the same id. So collisions would be very common.

(though it seems the sequence is shared across all the ipc objects.)

-- 
greg


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[GENERAL] I'm about to release the next postgresql RFD. Comments wanted.

2004-11-09 Thread Mike Cox
Obviously, there cannot be 21 postgresql groups in the comp.* hierarchy. 
Many of the 21 are not used that often, and would not be of much popularity
to those on usenet.

I did a check on news.postgresql.org to see which newsgroups are the most
popular and also the ones which cover the relevant postgresql topics.  Most
of the postgresql topics and traffic are represented in these four
newsgroups:

comp.databases.postgresql.admin
comp.databases.postgresql.general
comp.databases.postgresql.hackers
comp.databases.postgresql.sql

These are the four newsgroups that will be in the next version of the RFD. 
The newsgroups will be unmoderated, although the posters will be moderated
at the gateway side, with those who are subscribed will see their posts
make it to usenet and the mailing list.

A good way to think of this is that the subscription is a fast way to get
through moderation.  You have the option of not getting any emails.

For those on the news.groups who are not familiar with postgresql, join
news.postgresql.org and see the groups list.  You will see that making
these four groups proper members of the big 8 would solve most of the
usenet problems since the other groups do not have nearly the same amount
of traffic.

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [pgsql-www] [GENERAL] FTP mirror problems

2004-11-09 Thread Robert Treat
On Tue, 2004-11-09 at 13:21, Marc G. Fournier wrote:
 On Sun, 7 Nov 2004, Greg Sabino Mullane wrote:
  * We are keeping some very old versions around: 1.08, 1.09, the entire 6
  series. Is there any reason for this? For that matter, is there any reason
  to keep around lesser versions in a tree, especially ones that were replaced
  due to security bugs? Perhaps only keep the latest few versions and put a
  note in the readme to point to archives.postgresql.org or something?
 
  At the very least, a warning that some of the versions on the site have
  serious security flaws would be warranted.
 
 Historical, but we could easily create a source/OLD directory to move them 
 into, so they are less prominent?
 

IMHO they should be left as is. I've certainly had to make use of older
versions of the software in the past, and would not presume to know when
others won't want them in the future.  We keep a link to latest in the
main directory, and I'm willing to believe most people are capable of
figuring out which is the latest 7.3.x branch on their own (at least
until I see evidence to the contrary).  


Robert Treat  
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes:
 Oh I missed the fact that you were talking about after a reboot. So the
 algorithm I described would produce exactly the same sequence of ids after any
 reboot given the same sequence of creation and deletions. Even if there's a
 different sequence as long as the n'th creation is for the m'th array slot it
 would get the same id. So collisions would be very common.

This seems to square with Ed's complaint that he frequently sees a
collision after a reboot.  I've just committed some code that makes a
more extensive check as to whether a pre-existing segment actually has
any relevance to our data directory; should fix the problem.

regards, tom lane

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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Creating DB with pass, but pass not required to connect

2004-11-09 Thread Tom Lane
Pablo Gosse [EMAIL PROTECTED] writes:
 However, when I connect to this database via a php script, I can enter
 any valid database user, and I can enter anything for the password (or
 leave it blank), and I'm still able to connect.

Sounds like you don't have pg_hba.conf configured to demand password
authentication.  See
http://www.postgresql.org/docs/7.4/static/client-authentication.html

regards, tom lane

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


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Ed L.
On Tuesday November 9 2004 1:37, Tom Lane wrote:
  The shared memory block would certainly not still exist after a system
  reboot, so what we have here is a misleading error message.  Looking
  at the code, the most plausible explanation appears to be that
  shmctl(IPC_STAT) is failing (which it ought to) and returning some
  errno code different from EINVAL (which is the case we are expecting
  to see).

 I believe the attached patch will fix this problem for you, at least on
 the assumption that you are starting only one postmaster at system boot.

Just realizing we do start multiple postmasters under same user id when 
upgrading a cluster (one on old port, one on new).

I noticed that ipcs on my linux box has a command-line option to list the 
pid that created the segment.  Not sure if such a library exists in usable 
form, but looking for segments owned by the downed postmaster's pid would 
seem to be what is needed.  Just a thought...

Ed


---(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] server auto-restarts and ipcs

2004-11-09 Thread Tom Lane
Ed L. [EMAIL PROTECTED] writes:
 I noticed that ipcs on my linux box has a command-line option to list the 
 pid that created the segment.  Not sure if such a library exists in usable 
 form, but looking for segments owned by the downed postmaster's pid would 
 seem to be what is needed.  Just a thought...

[ thinks about it... ]  Nah, it's still not bulletproof, because in a
system reboot situation you can't trust the old PID either.  It could
easy be that the other guy gets both the PID and the shmem ID that
belonged to you last time.

I've committed changes for 8.0 that mark a shmem segment with the inode
of the associated data directory; that should be a stable enough ID to
handle all routine-reboot cases.  (If you had to restore your whole
filesystem from backup tapes, it might be wrong, but you're going to be
doing such recovery manually anyway ...)

regards, tom lane

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

   http://archives.postgresql.org


[GENERAL] ANNOUNCE: Bricolage 1.8.3

2004-11-09 Thread David Wheeler
The Bricolage development team is pleased to announce the release of
Bricolage 1.8.3. This maintenance release addresses quite a large
number of issues in Bricolage 1.8.2. The most important changes 
were to
enhance Unicode support in Bricolage. Bricolage now internally 
handles
all text content as UTF-8 strings, thus enabling templates to better
control the manipulation of multibyte characters. Other changes 
include
better performance for searches using the ANY() operators and more
intelligent transaction handling for distribution jobs. Here are the
other highlights of this release:

 Improvements
  * Added contrib/thumbnails/precreate-thumbs.pl script to 
pre-create
  thumbnails from images. Useful for upgraders. [Scott]

  * Added contrib/bric_import_contribs to import contributors from a
  tab-delimited file. Development by Kineticode, sponsored by the 
RAND
  Corporation. [David]

  * Added the published_version parameter to the list() methods of 
the
  story, media, and template classes. This parameter forces the 
search
  to return the versions of the assets as they were last published,
  rather than the most recent version. This will be most useful to
  those looking up other documents in templates and publishing 
them, as
  a way of avoiding pulling documents out from other anyone who 
might
  have them checked out! [David]

  * All publishing and distribution jobs are now executed in their 
own
  transactions when they are triggered by the user interface. This 
is
  to reduce the chances of a deadlock between long-running 
publishing
  transactions. [David]

  * Optimized SQL queries for key names or that order by string 
values
  to use indexes in the list() and list_ids() methods of the story,
  media, and template classes. [David]

  * Added Russian localization. [Sergey Samoilenko].
  * Changed the foreign keys in the story, media, and formatting
  (template) tables so that DELETEs do not cascade, but are 
restricted.
  This means that before deleting any source, element, site, 
workflow,
  or other related object that has a foreign key reference in an 
asset
  table, those rows must be deleted. Otherwise, PostgreSQL will 
throw
  an exception. Hopefully, this will put a stop to the mysterious 
but
  very rare disappearance of stories from Bricolage. [David]

  * A call to $burner-burn_another in a template that passes in a
  date/time string in the future now causes a publish job to be
  scheduled for that time, rather than immediate burning the 
document
  and then scheduling the distribution to take place in the future.
  Reported by Ashlee Caul. [David]

  * Changing the sort order of a list of items in a search interface
  now properly reverses the entire collection of object over the 
pages,
  rather than just the objects for the current page. Thanks to 
Marshall
  for the spot! [David]

 Bug Fixes
  * Publishing stories not in workflow via the SOAP server works 
again.
  [David]

  *
  * The Burner object's encoding attribute is now setable as well as
  readable. [David]
  * The category browser works again. [David]
  * Fixed Media Upload bug where the full local path was being 
used, by
  adding a 'winxp' key to Bric::Util::Trans::FS to account for an
  update to HTTP::BrowserDetect. [Mark Kennedy]

  * Instances of a required custom field in story elements is no 
longer
  required once it has been deleted from the element definition in 
the
  element manager. Reported by Rod Taylor. [David]

  * A false value passed to the checked_out parameter of the list() 
and
  list_ids() methods of the story, media, and template (formatting)
  classes now properly returns only objects or IDs for assets that 
are
  not checked out. [David]

  * The cover date select widget now works properly in the clone
  interface when a non-ISO style date preference is selected. 
Thanks to
  Susan G. for the spot! [David]

  * Sorting templates based on Asset Type (Element) no longer 
causes an
  error. [David]

  * Fixed a number of the callbacks in the story, media, and 
template
  profiles so that they didn't clear out the session before other
  callbacks were done with it. Most often seen as the error 'Can't 
call
  method get_tiles on an undefined value' in the media profile,
  especially with IE/Windows (for some unknown reason). Reported by 
Ed
  Stevenson. [David]

  * Fixed typo in clone page that caused all output channels to be
  listed rather than only those associated with the element itself.
  [Scott]
  * Fixed double listing of the All group in the group membership
  double list manager. [Christian Hauser]
  * Image buttons now correctly execute the onsubmit() method for 
forms
  

Re: [GENERAL] I'm about to release the next postgresql RFD. Comments

2004-11-09 Thread Marc G. Fournier
As a side note ... if/when the CFV is called and those 4 are 
approved/rejected, that will not change what is available on 
news.postgresql.org, it will only improve the propogation of those 4 
specific groups so that more servers around the world carry them ...

On Tue, 9 Nov 2004, Mike Cox wrote:
Obviously, there cannot be 21 postgresql groups in the comp.* hierarchy.
Many of the 21 are not used that often, and would not be of much popularity
to those on usenet.
I did a check on news.postgresql.org to see which newsgroups are the most
popular and also the ones which cover the relevant postgresql topics.  Most
of the postgresql topics and traffic are represented in these four
newsgroups:
comp.databases.postgresql.admin
comp.databases.postgresql.general
comp.databases.postgresql.hackers
comp.databases.postgresql.sql
These are the four newsgroups that will be in the next version of the RFD.
The newsgroups will be unmoderated, although the posters will be moderated
at the gateway side, with those who are subscribed will see their posts
make it to usenet and the mailing list.
A good way to think of this is that the subscription is a fast way to get
through moderation.  You have the option of not getting any emails.
For those on the news.groups who are not familiar with postgresql, join
news.postgresql.org and see the groups list.  You will see that making
these four groups proper members of the big 8 would solve most of the
usenet problems since the other groups do not have nearly the same amount
of traffic.
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings

Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [GENERAL] server auto-restarts and ipcs

2004-11-09 Thread Ed L.
On Tuesday November 9 2004 4:35, Tom Lane wrote:
 Ed L. [EMAIL PROTECTED] writes:
  I noticed that ipcs on my linux box has a command-line option to list
  the pid that created the segment.  Not sure if such a library exists in
  usable form, but looking for segments owned by the downed postmaster's
  pid would seem to be what is needed.  Just a thought...

 [ thinks about it... ]  Nah, it's still not bulletproof, because in a
 system reboot situation you can't trust the old PID either.  It could
 easy be that the other guy gets both the PID and the shmem ID that
 belonged to you last time.

I see.  Ipcs on my box also lists the date/time of shared memory segment 
attach/detach/change (ipcs -t), but ...

 I've committed changes for 8.0 that mark a shmem segment with the inode
 of the associated data directory; that should be a stable enough ID to
 handle all routine-reboot cases.  (If you had to restore your whole
 filesystem from backup tapes, it might be wrong, but you're going to be
 doing such recovery manually anyway ...)

...that will remove a major hassle for us and lots of other.  Thanks.

Ed





---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [pgsql-www] [GENERAL] FTP mirror problems

2004-11-09 Thread Greg Sabino Mullane

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
 
 Huh?  Just checked, the file hasn't been modified since Nov 15th, 2001,
 and the URL looks fine to me:

 svr1# grep http README
http://www.postgreSQL.org
 
I though we tended to discourage making the 'postgre' and the 'SQL'
distinct. Lowercasing and a trailing slash and its perfect.
 
[README.cvsup]
 have you tested this?
 
Nope, I misread the modification time. All is well.
 
[README.dist-split]
 If you would like to submit a re-write, I'll put it into place ... I
 think mentioning the bz files seperately would just bulk up the file
 ... ppl would see the .bz when they go to the directory itself ...
 
Perhaps not everyone is familar with the .bz and and .md5 extensions.
A minor point, however. Perhaps it could just get rolled in with the new
README?
 
Thanks for taking care of the rest of the items. I'll [re]write a README[.win32]
if I get a chance, but I am currently swamped.
 
- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200411091925
-BEGIN PGP SIGNATURE-
 
iD8DBQFBkWAwvJuQZxSWSsgRAuKxAJ0eVpUA65ZpmDYPCGNGyuYCtZCugwCglMni
+4eTbwppsIdTewIYfYLAsHE=
=kGJe
-END PGP SIGNATURE-



---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] ANN: PgBrowse-1.0

2004-11-09 Thread Jerry LeVan
Sigh, I can't read what I write...
The correct homepage for PgBrowse is:
http://homepage.mac.com/levanj/TclTk
I guess the correction was probably obvious :)
Jerry
On Nov 9, 2004, at 6:57 PM, [EMAIL PROTECTED] wrote:
The homepage for PgBrowser is:
http://homepage.mac.com/levanj/TckTk
Feedback and enhancements are welcome.

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


Re: [GENERAL] I'm about to release the next postgresql RFD. Comments wanted.

2004-11-09 Thread Mike Cox
Brian Mailman wrote:

 [EMAIL PROTECTED] wrote:
 
 I am affiliated with a network of over 60 PostgreSql users/developers,
 and I will e-mail each one of those people a ballot...
 
 You should not do that.
 
 Those ballots will be invalidated since only the official ballots that
 are posted or obtained directly from the votetaker are going to be
 counted.
 
 B/

Agreed.  The person should email all the people in his network to visit
news.groups to find out how to obtain an official ballot legally.  

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


Re: [GENERAL] Important Info on comp.databases.postgresql.general

2004-11-09 Thread Mike Cox
[EMAIL PROTECTED] wrote:

 The lists are not bogus and your suggestion is not acceptable. Many of
 the list subscribers have no connection to Usenet. They will be mailed
 the ballots, regardless of what you or anyone else say. They are the
 people who will be directly affected by this.
 

You should direct them to usenet so they can get offical legal ballots. 
Ballots obtained the way you say may be invalidated!

For those without usenet access, www.individual.net has a free usenet sever
you can use.  It does not carry the postgresql groups BUT it does have
news.groups.

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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] I'm about to release the next postgresql RFD. Comments

2004-11-09 Thread Mike Cox
Woodchuck Bill wrote:

 [EMAIL PROTECTED] (Marc G. Fournier) wrote in
 news:[EMAIL PROTECTED]:
 
 As a side note ... if/when the CFV is called and those 4 are
 approved/rejected, that will not change what is available on
 news.postgresql.org, it will only improve the propogation of those 4
 specific groups so that more servers around the world carry them ...
 
 [reply from list owner crossposted to news.groups]

Exactly.  The groups that are relevant to most (determined by # of posts)
will get wider exposure ensuring that more people will take up postgresql
or have better access to help.

The ones not on the list to be made into the big 8 will always be accessible
from the news.postgresql.org server. 

Also, please, if I've missed an important group you think SHOULD be in the
big 8, please let me know in this thread.

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] Trying to get postgres to use an index

2004-11-09 Thread Mike Wertheim
I have some more info on my indexing situation, and a new question.

In my previous email, I told about 2 tables: Notification and Item,
which join on a field called ItemID.  The joining query didn't execute
as quickly as I thought it should. I now notice that I have another
table, Folder, which joins with Item in a similar way, and the
performance of that join is excellent.

So my new questions is...  What makes the Folder join faster than the
Notification join?


Here is some info on the tables, queries, and explain analyze
output...

Item's primary key is ItemID (int4).
Folder's primary key is ItemID (int4).  Folder also contains 4 varchar
columns, 2 text columns, 6 bool columns, 7 datetime columns and 1 int4
column.
Notification has an index on its ItemID (int4) field.  Notification also
contains 7 text columns (1 of them being the primary key), 3 timestamp
columns and 4 int4 columns.

Folder and Notification have a similar number of rows.  select count(*)
from folder returns 193043.  select count(*) from notification
returns 223689.


The first query is: select count(*) from FOLDER f, ITEM i where
f.itemID = i.itemID and i.projectid=7720.  This query returns the
result 5 and executes in less than 1 second.

The second query is: select count(*) from NOTIFICATION n, ITEM i where
n.itemID = i.itemID and i.projectid=7720.  This query returns the
result 2 and executes in about 40 seconds.


Here's the explain analyze output...

The Folder query uses the indexes:
explain analyze select count(*) from FOLDER f, ITEM i where f.itemID =
i.itemID and i.projectid=7720;   Aggregate  (cost=6371.88..6371.88
rows=1 width=0) (actual time=83.557..83.558 rows=1 loops=1)
   -  Nested Loop  (cost=0.00..6371.31 rows=227 width=0) (actual
time=17.929..83.502 rows=5 loops=1)
 -  Index Scan using item_ix_item_4_idx on item i
(cost=0.00..2105.51 rows=869 width=4) (actual time=0.098..19.409 rows=51
loops=1)
   Index Cond: (projectid = 7720)
 -  Index Scan using folder_pkey on folder f  (cost=0.00..4.90
rows=1 width=4) (actual time=1.255..1.255 rows=0 loops=51)
   Index Cond: (f.itemid = outer.itemid)
 Total runtime: 92.185 ms


The Notification query does a sequential scan on Notification:
explain analyze select count(*) from NOTIFICATION n, ITEM i where
n.itemID = i.itemID and i.projectid=7720;
 Aggregate  (cost=38732.31..38732.31 rows=1 width=0) (actual
time=40380.497..40380.498 rows=1 loops=1)
   -  Hash Join  (cost=2107.69..38731.65 rows=263 width=0) (actual
time=36341.174..40380.447 rows=2 loops=1)
 Hash Cond: (outer.itemid = inner.itemid)
 -  Seq Scan on notification n  (cost=0.00..35502.89
rows=223689 width=4) (actual time=8289.236..40255.341 rows=223689
loops=1)
 -  Hash  (cost=2105.51..2105.51 rows=869 width=4) (actual
time=0.177..0.177 rows=0 loops=1)
   -  Index Scan using item_ix_item_4_idx on item i
(cost=0.00..2105.51 rows=869 width=4) (actual time=0.025..0.127 rows=51
loops=1)
 Index Cond: (projectid = 7720)
 Total runtime: 40380.657 ms


So my question is...  What difference do you see between the Folder and
Notification tables that would account for such a big difference in
query performance?  And how can I make the Notification query run about
as fast as the Folder query?



---(end of broadcast)---
TIP 8: explain analyze is your friend


[GENERAL] Transaction rollback - newbie

2004-11-09 Thread A. Mous
Hi,

I've got clients connected to pgsql via ODBC.  If they lose their connection
abruptly, all un-committed transactions are automatically rolled-back (I'm
assuming) but is there anything left behind that needs to be cleaned up on
the server side with regards to the uncommitted transaction(s)?

Much thanks!




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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] new data types

2004-11-09 Thread Michael Fuhr
On Tue, Nov 09, 2004 at 02:20:23PM -0500, Alexander Cohen wrote:
 
 When i write code in C to create the functions that define a new data 
 type, how can i set a value so that the user sees a null value from 
 sql.

What do you mean sees a null value from sql, and under what
circumstances should this happen?  What are you trying to do?

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[GENERAL] unconvertible BIG5 character 0xf9d8

2004-11-09 Thread CN
Hi!

My 8.0beta2 database was initialized with option -E UNICODE. Psql sets
client encoding to Big5:

database1=# \encoding big5

I get this error when inserting Big5 character 0xf9d8:

WARNING:  ignoring unconvertible BIG5 character 0xf9d8

Any idea?

Regards,
CN

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

   http://archives.postgresql.org


[GENERAL] the column in Update

2004-11-09 Thread John Fabiani
From the 7.4 docs:
 A column can be referenced in the form

correlation.columnname

correlation is the name of a table (possibly qualified with a schema name), or 
an alias for a table defined by means of a FROM clause, or one of the key 
words NEW or OLD. (NEW and OLD can only appear in rewrite rules, while other 
correlation names can be used in any SQL statement.) The correlation name and 
separating dot may be omitted if the column name is unique across all the 
tables being used in the current query. (See also Chapter 7.) 

So then why does this not work:
Update tablename set tablename.columnName = 'somedata' where .

John

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] Transaction rollback - newbie

2004-11-09 Thread Doug McNaught
A. Mous [EMAIL PROTECTED] writes:

 Hi,

 I've got clients connected to pgsql via ODBC.  If they lose their connection
 abruptly, all un-committed transactions are automatically rolled-back (I'm
 assuming) but is there anything left behind that needs to be cleaned up on
 the server side with regards to the uncommitted transaction(s)?

No.  When the connection goes away, the backend will log an error,
roll back the transaction and exit cleanly.

-Doug

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


Re: [GENERAL] Transaction rollback - newbie

2004-11-09 Thread David Helgason
Anytime data changes in Postgres, the old rows are still on the disk. 
This is true regardless if the transaction rolls back.

Read in the docs about vacuuming, which is a process that cleans this 
up.

Regards,
d.
--
David Helgason,
Business Development et al.,
Over the Edge I/S (http://otee.dk)
Direct line +45 2620 0663
Main line +45 3264 5049
On 10. nov 2004, at 03:38, Doug McNaught wrote:
A. Mous [EMAIL PROTECTED] writes:
Hi,
I've got clients connected to pgsql via ODBC.  If they lose their 
connection
abruptly, all un-committed transactions are automatically rolled-back 
(I'm
assuming) but is there anything left behind that needs to be cleaned 
up on
the server side with regards to the uncommitted transaction(s)?
No.  When the connection goes away, the backend will log an error,
roll back the transaction and exit cleanly.
-Doug
---(end of 
broadcast)---
TIP 1: subscribe and unsubscribe commands go to 
[EMAIL PROTECTED]


---(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


[GENERAL] These Lists Are Being Cut To FOUR

2004-11-09 Thread Mike Cox
Hello. My name is Mike Cox. I am in charge of the changing of these
postgresql lists. I have decided that we are going to drop most of the
lists from the vote. We will only be making 4 lists into real Usenet
newsgroups if we win the election. The rest of the lists are crap and
they take up too much fucking room. Marc was an asshole for stealing
BIG8 newsgroup names without voting. He is an irresponsible piece of
shit scumbag cock-licking anus-eating foreskin-sniffing motherfucking
faggot. He has an ego the size of Dolly Parton's tits. Be sure to vote
yes on all four of these lists or every list will be removed. 

Your support is most appreciated.

Mike Cox
[EMAIL PROTECTED]

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

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Important Info on comp.databases.postgresql.general

2004-11-09 Thread Mike Cox
Joseph Daniel Zukiger wrote:


 It looks like I'm may have to finally subscribe through my isp and
 learn how to configure a newsreader in order to vote in favor, instead
 of posting through google all the time. That should speed my access to
 usenet up quite a bit. Oh, well.
 
 JouDanZuki

You can go to www.individual.net and get a free usenet account.

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match