FW: [GENERAL] code to cancel a running query, worker thread

2006-04-19 Thread surabhi.ahuja
  Help needed,   i have the following peice of code, which is meant for cancelling queries in between   import java.sql.*; public class QueryExecutor implements Runnable {  /**  * @param args  */ private Thread worker; private Params params; private Results results; private volatile boolean

Re: [GENERAL] primary keys

2006-04-19 Thread Klint Gore
On Wed, 19 Apr 2006 19:39:45 -0700, Orion Henry <[EMAIL PROTECTED]> wrote: > I'm trying to craft a query that will determine what column(s) are the > primary key for a given table. I have succeeded but the query is so > ugly that it borders on silly and cannot work for an arbitrary number of >

Re: [GENERAL] deleting table content through command prompt

2006-04-19 Thread Harvey, Allan AC
Try psql.exe -h localhost -U your_user -d your_database -c "drop table your_tablename;" Assumption: windows switches are the same as the *nix ones > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > [EMAIL PROTECTED] > Sent: Thursday, 20 April 2006 9:0

Re: [GENERAL] locating a primary key

2006-04-19 Thread Joshua D. Drake
Orion wrote: I'm trying to craft a query that will determine what column(s) belong to the primary key for a given table. This seems like the kind of thing that would very common for people to try to do but my query was rather ugly and not flexible since it does not work for an arbitrary number

[GENERAL] problem while adding a column

2006-04-19 Thread Shoaib Mir
When ever trying to add a new column to the table get the following error ERROR:  duplicate key violates unique constraint "pg_attribute_relid_attnum_index"While the new column that is added is not there in the table before.Doing a select * from table from the same tables also giving an error sayin

Re: [GENERAL] locating a primary key

2006-04-19 Thread Tom Lane
Orion <[EMAIL PROTECTED]> writes: > I'm trying to craft a query that will determine what column(s) belong > to the primary key for a given table. The information_schema.key_column_usage view might help. > This is all due to the use of > the int2vect type on indkey which is undocumented and does n

Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-19 Thread Ian Harding
You should look up the contrib module ltree which is made for this sort of thing. If you reinvent the wheel like this, you will be stuck with 2 levels. With ltree you can have as many as you need and add more at any time. It lets you query for ancestors and descendants of any item at any level.

[GENERAL] recovery problem

2006-04-19 Thread jayati . biswas
I want to prepare a backup machine (for disaster management) by passing only the ARCHIVEDIR directory from another online machine - both the machines have Postgresql installed. We have sent PGLOG and ARCHIVEDIR. Previously it was working,but now,when I am issuing pg_ctl start,it is giving e

Re: [GENERAL] Query to check existence of stored procedure?

2006-04-19 Thread Alexander Scholz
Hi Jim, >> select count(*) from pg_proc where proname = 'your_function'; >> > don't forget about schema's, you will need to join with > pg_namespace.oid and pg_proc.pronamespace your answer looks a little bit cryptic for me being somebody who hasn't had to dive into the pg_... tables yet. :-) W

[GENERAL] recovery problem

2006-04-19 Thread jayati . biswas
hello, I am trying to setup a "hot standby" on a second machine. I have created a "recovery.conf" file and started a restore with logs from the primary machine. everything was OK. now a have new transaction logs generated by the primary machine and I want to "play" them on the secondary one. I

[GENERAL] tomcat postgresql connectivity error

2006-04-19 Thread Danish
Hi, Im trying to run a web application from tomcat which connects to a database on postgresql 8.1.3 But when it tries to connect to a database.an E 101 Exception occured while retrieving results. is shown When I checked up the logs of tomcat.I could see.. SQLException [ERROR: No parser

[GENERAL] consulta SELECT FOR UPDATE

2006-04-19 Thread jonathan ramirez
Saludo.Tengo un problema con una consulta, como puedo insertar o actualizar un conjunto de datos en una tabla. Hice una consulta para comprarar dos tablas y el resultado los inserto en una nueva tabla, esa nueva tabla tengo los datos que se deben de actualizar en otra tabla, ya tengo la consulta qu

[GENERAL] deleting table content through command prompt

2006-04-19 Thread sconeek
hi all, i am trying to create a database backup and restore windows batch file, which when run will do a database table backup and a corresponding table restore. now for table_usernames backup i run something like from the command prompt, pg_dump.exe -i -h localhost -p 5432 -U postgres -F t -v -f

[GENERAL] postmaster services problem

2006-04-19 Thread liishyan
Hi,   I’m having problem starting the postmaster service at my office’s server now. Everything works fine for a year. But today morning, the I was unable to log into the database server.   When I tried to start the postmaster service, it says, “The service started and stopped. Some se

[GENERAL] Permission problem opening database

2006-04-19 Thread Dilan A
Hi, I have done some RTFMing and come up with little on this one. I have a database that I had setup in the past that I haven't opened for a while created under 8.1 running the native Win32 port. When I started the postgres service and tried connecting using PgAdmin III I got the following e

[GENERAL] tomcat postgresql database connectivity error

2006-04-19 Thread dsids
Hi, Im trying to connect to a postgresql database from a web application running on tomcat... But the moment my web application connects an error is thrown up at the postgresql logs - ERROR: No parser with id 19369 The tomcat logs show the following error: -- com.rapidigm.bacs.db

[GENERAL] primary keys

2006-04-19 Thread Orion Henry
I'm trying to craft a query that will determine what column(s) are the primary key for a given table. I have succeeded but the query is so ugly that it borders on silly and cannot work for an arbitrary number of tables since indkey is an int2vect and the ANY keyword does not work on it. Ple

[GENERAL] locating a primary key

2006-04-19 Thread Orion
I'm trying to craft a query that will determine what column(s) belong to the primary key for a given table. This seems like the kind of thing that would very common for people to try to do but my query was rather ugly and not flexible since it does not work for an arbitrary number of columns in t

Re: [GENERAL] Calling the same function more than once with the same arguments

2006-04-19 Thread Tom Lane
"Clodoaldo Pinto" <[EMAIL PROTECTED]> writes: > I'm building a function caller() in which a certain function called() > will be called many times in from clauses with the same arguments and > I'm wondering if is there a performance penalty for that or if the sql > engine is smart enough to call cal

Re: [GENERAL] Calling the same function more than once with the same

2006-04-19 Thread Ben
Look into the immutable flag on function creation: http://www.postgresql.org/docs/8.1/interactive/xfunc-volatility.html On Wed, 19 Apr 2006, Clodoaldo Pinto wrote: I'm building a function caller() in which a certain function called() will be called many times in from clauses with the same arg

[GENERAL] Calling the same function more than once with the same arguments

2006-04-19 Thread Clodoaldo Pinto
I'm building a function caller() in which a certain function called() will be called many times in from clauses with the same arguments and I'm wondering if is there a performance penalty for that or if the sql engine is smart enough to call called() only once. I tried to substitute called() in th

Re: [GENERAL] help plpgsql, cursors, fetch into

2006-04-19 Thread Mauricio Mantilla
Yes, it sure looks like a bug, this function used to work before, besides I have another function that's pretty similar and it works. Anyway, I did an script creating new tables and functions, and the function worked. I also found that in the original function i had another sentence which is t

[GENERAL] plperl on AIX

2006-04-19 Thread John F Rizzo
I'm having trouble getting plperl to work on AIX 5.3.2. Postgresql Version: 8.1.1 Perl Version: 5.8.7 I've rebuilt perl as a shared library version and built that into postgre using --with-perl.  The postgre build/install works fine, without errors. The plperl regression tests all fail, though.

[GENERAL] Error while adding a column

2006-04-19 Thread Shoaib Mir
Hi All,While trying to add a column to the table below. On DESC of the table I do not see the column name, but on adding it, it complains of it already being present, and on trying to drop it I get the "ERROR:  cache lookup failed for attribute 56 of relation 16681:" error.desc test_users;        

Re: [GENERAL] grant privileges across schemas

2006-04-19 Thread Bruno Wolff III
On Wed, Apr 19, 2006 at 09:29:50 -0300, Fernan Aguero <[EMAIL PROTECTED]> wrote: > > The following works, but I'm not sure about the consequences > of granting USAGE to a schema, as the documentation is > not clear, IMO : "For schemas, allows access to objects > contained in the specified schema

Re: [GENERAL] Translating sql error codes

2006-04-19 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > I want that end users see error messages descibed in > Appendix A. PostgreSQL Error Codes > in Estonian. > I can provide translations to those error codes. > How to make Postgres server to return my translated error messages ? Step right up and become a tran

[GENERAL] Translating sql error codes

2006-04-19 Thread Andrus
I want that end users see error messages descibed in Appendix A. PostgreSQL Error Codes in Estonian. I can provide translations to those error codes. How to make Postgres server to return my translated error messages ? Or is it more reasonable to implement this in my application by displaying

Re: [GENERAL] help plpgsql, cursors, fetch into

2006-04-19 Thread Tom Lane
Mauricio Mantilla <[EMAIL PROTECTED]> writes: > Hi, I'm having a problem with FETCH INTO, but I can't figure out what it is. That kinda looks like a bug. Which PG version are you using exactly? Could you provide a self-contained test case (ie, a script to create the needed tables and sample data)

Re: [GENERAL] How to implement a "subordinate database"?

2006-04-19 Thread Bruno Wolff III
On Wed, Apr 19, 2006 at 06:19:50 -0400, Kynn Jones <[EMAIL PROTECTED]> wrote: > I keep bumping against this situation: I have a main database A, and I want > to implement a database B, that is distinct from A, but subordinate to it, > meaning that it refers to data in A, but not vice versa. > >

[GENERAL] help plpgsql, cursors, fetch into

2006-04-19 Thread Mauricio Mantilla
Hi, I'm having a problem with FETCH INTO, but I can't figure out what it is.   I have this function which works out well:   CREATE OR REPLACE FUNCTION Cercanos(punto geometry,radio float, tipo varchar(1)) RETURNS refcursor AS $$DECLAREmycurs refcursor;BEGIN    OPEN mycurs FOR SELECT id FROM

Re: [GENERAL] page is uninitialized?

2006-04-19 Thread Brendan Duddridge
Hi Tom, I had a problem recently with an index on my category_product table. A few times when I was vacuuming that table, I had forgotten to reset our statement_timeout setting from 2 minutes to 0, so a few times the statement was cancelled pre-maturely due to the timeout setting. Perhaps that c

Re: [GENERAL] Categories and Sub Categories (Nested)

2006-04-19 Thread Alban Hertroys
Martin Kuria wrote: Hi, I have a postgresql database Table Categories which has the structure like this Cat_ID | Parent_ID | Name 1 | 0 | Automobiles 2 | 0 | Beauty & Health 3 | 1 | Bikes 4 | 1 | Cars 5 | 3 | Suzuki 6 | 3 | Yamaha 7 | 0 | Clothes This ha

Re: [GENERAL] page is uninitialized?

2006-04-19 Thread Tom Lane
Brendan Duddridge <[EMAIL PROTECTED]> writes: > I was doing a vacuum analyze verbose on my database today and I > noticed the following message printed out: > WARNING: relation "category_product" page 128979 is uninitialized > --- fixing > WARNING: relation "category_product" page 128980 is

Re: [GENERAL] page is uninitialized?

2006-04-19 Thread Tom Lane
Brendan Duddridge <[EMAIL PROTECTED]> writes: > Shortly after posting this message, I received the following error also: > PANIC: right sibling is not next child in > "category_product__is_active_idx" Last week's report of that same error was traced to running with full_page_writes turned off;

Re: [GENERAL] Bulk inserts within a Perl script?

2006-04-19 Thread Kynn Jones
Thank you all for cluing me in on pg_putline and pg_endcopy.  Much cleaner than my kluge.   kj  

[GENERAL] some error messages in postgeslog

2006-04-19 Thread surabhi.ahuja
I use PostgreSQL 8.0.0   it seems that the disk was close to full,   i executed a program (in C++) which opens a connection to Postgres using PQConnectdb.   and then it reads from a particluar table, and simply displays the values on the console.   after doing that it will close the connection

[GENERAL] grant privileges across schemas

2006-04-19 Thread Fernan Aguero
Hi, I'm using a database that is splitted into a number of schemas. In my local installation I'd like to have 3 users: a dba (ALL privileges), a user with read-write (INSERT/UPDATE/DELETE on all tables and views and SELECT on all sequences) privileges and a user with read-only (SELECT on all table

Re: [GENERAL] strange query filter problems

2006-04-19 Thread Martijn van Oosterhout
On Wed, Apr 19, 2006 at 01:53:46PM +0200, Jonas Henriksen wrote: > Yes, explain analyze looks like this: Well, incorrect statistics are definitly the culprit, look: > " -> Index Scan using sskjema_pkey on sskjema s (cost=0.00..3868.95 > rows=9738 width=157) (actual time=104.465..208.185 rows

Re: [GENERAL] strange query filter problems

2006-04-19 Thread Jonas Henriksen
Yes, explain analyze looks like this: EXPLAIN ANALYZE SELECT * FROM sskjema s inner join tskjema t using(sskjema_pkey) where t.species::char(12) like 'TAGGMAKRELL%'::char(12) and s.date >=20050101 "Merge Join (cost=6.02..3899.33 rows=1 width=228) (actual time=150.274..331.782 rows=190 loops=1)"

Re: [GENERAL] strange query filter problems

2006-04-19 Thread Martijn van Oosterhout
On Wed, Apr 19, 2006 at 01:27:45PM +0200, Jonas Henriksen wrote: > Hi, > I have a problem with a slow query. (I have run vacuum full analyze!) > It seems that the query below works OK because the query planner > filters on the date first. It takes about 0.3 sec: Can we see an EXPLAIN ANALYZE of th

Re: [GENERAL] How to implement a "subordinate database"?

2006-04-19 Thread chris smith
On 4/19/06, Kynn Jones <[EMAIL PROTECTED]> wrote: > > I keep bumping against this situation: I have a main database A, and I want > to implement a database B, that is distinct from A, but subordinate to it, > meaning that it refers to data in A, but not vice versa. > > I don't simply want to add ne

[GENERAL] strange query filter problems

2006-04-19 Thread Jonas Henriksen
Hi, I have a problem with a slow query. (I have run vacuum full analyze!) It seems that the query below works OK because the query planner filters on the date first. It takes about 0.3 sec: EXPLAIN SELECT * FROM sskjema s INNER JOIN tskjema t USING(sskjema_pkey) WHERE t.species::char(12) LIKE 'TAGG

[GENERAL] How to implement a "subordinate database"?

2006-04-19 Thread Kynn Jones
I keep bumping against this situation: I have a main database A, and I want to implement a database B, that is distinct from A, but subordinate to it, meaning that it refers to data in A, but not vice versa.   I don't simply want to add new tables to A to implement B, because this unnecessarily clu

[GENERAL] code to cancel a running query, worked thread

2006-04-19 Thread surabhi.ahuja
i have the following peice of code, which is meant for cancelling queries in between   import java.sql.*; public class QueryExecutor implements Runnable {  /**  * @param args  */ private Thread worker; private Params params; private Results results; private volatile boolean cancelRequest; privat

Re: [GENERAL] page is uninitialized?

2006-04-19 Thread Brendan Duddridge
It turns out I had a bad index on my category_product table. I dropped the index, then reindexed the whole table, then I wasable to successfully vacuum analyze.Thanks, Brendan Duddridge | CTO | 403-277-5591 x24 |  [EMAIL PROTECTED]

Re: [GENERAL] page is uninitialized?

2006-04-19 Thread Brendan Duddridge
Hi,Shortly after posting this message, I received the following error also:PANIC:  right sibling is not next child in "category_product__is_active_idx"server closed the connection unexpectedly        This probably means the server terminated abnormally        before or while processing the request.

[GENERAL] page is uninitialized?

2006-04-19 Thread Brendan Duddridge
Hi,I was doing a vacuum analyze verbose on my database today and I noticed the following message printed out:WARNING:  relation "category_product" page 128979 is uninitialized --- fixingWARNING:  relation "category_product" page 128980 is uninitialized --- fixingWARNING:  relation "category_product

Re: [GENERAL] catch SQLException, error code for Foeign key violation,

2006-04-19 Thread Kris Jurka
On Wed, 19 Apr 2006, surabhi.ahuja wrote: what is the way to capture such exception in Cpp, are there any examples available for this? right now in cpp, i do this rStatus = PQresultStatus(result); but what is the specific error code, how to get that, See PQresultErrorField http://www.po