Re: [GENERAL] Problem with oids for table names getting out of sync?

2007-04-05 Thread Tom Lane
Omar Eljumaily [EMAIL PROTECTED] writes:
 I've run into this sort of obscure problem.  I'm using libpq with a 
 front end database api where I need to track column names and how 
 they're returned in libpq queries.  What's happening is that I start out 
 with a set of table names when I open my database with a query:

 SELECT relfilenode, relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' 
 AND relkind = 'r'

 But these don't agree with the oids when I subsequently fetch my rows 
 and use the following:

 Oid o = PQftable(_res, i);

Um ... are you laboring under some delusion about relfilenode being the
same as relation OID?

regards, tom lane

---(end of broadcast)---
TIP 1: 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] Adding multiple column in alter statement?

2007-04-05 Thread A. Kretschmer
am  Thu, dem 05.04.2007, um  6:58:01 +0100 mailte Ashish Karalkar folgendes:
 Hello All,
 I want to add multiple  column to a table using single alter statemet,
 someting like this:
  
 alter table admin_session  add column accounting_session varchar(1) not null
 default '0',accounting_active varchar(1),acc_start_date date,acc_end_date 
 date;
  
 is there any way?

Yes, read the doc ;-)

test=# \d bla
  Table public.bla
 Column |  Type   | Modifiers
+-+---
 id | integer |

test=# alter table bla add column name1 text, add column name2 text, add column 
name3 text;
ALTER TABLE
test=*# \d bla
  Table public.bla
 Column |  Type   | Modifiers
+-+---
 id | integer |
 name1  | text|
 name2  | text|
 name3  | text|




Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

---(end of broadcast)---
TIP 1: 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] Adding multiple column in alter statement?

2007-04-05 Thread Ashish Karalkar
Hello All,
  I want to add multiple  column to a table using single alter statemet,
  someting like this:
   
  alter table admin_session  add column accounting_session varchar(1) not null 
default '0',accounting_active varchar(1),acc_start_date date,acc_end_date date;
   
  is there any way?
   
  Thanks in Advance
   
  With Regards
  Ashish...


-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar

Even More is there any way to grant permission to a user on another database ??
   
  With Regards
  Ashish
A. Kretschmer [EMAIL PROTECTED] wrote:
  am Wed, dem 04.04.2007, um 22:23:20 -0700 mailte Postgres User folgendes:
 Is there a way to grant INSERT and UPDATE permissions on all the
 tables in a database? I don't want to type-in every table name...

http://people.planetpostgresql.org/greg/index.php?/archives/38-Scripting-with-psql.html#extended


Andreas
-- 
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

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



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar

Even More is there any way to grant permission to a user on another database ??
   
  With Regards
  Ashish
A. Kretschmer [EMAIL PROTECTED] wrote:
  am Wed, dem 04.04.2007, um 22:23:20 -0700 mailte Postgres User folgendes:
 Is there a way to grant INSERT and UPDATE permissions on all the
 tables in a database? I don't want to type-in every table name...

http://people.planetpostgresql.org/greg/index.php?/archives/38-Scripting-with-psql.html#extended


Andreas
-- 
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

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



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: [GENERAL] All objects of a Particular USER

2007-04-05 Thread Zongliang, Quan
See here:

http://www.postgresql.org/docs/8.2/static/catalog-pg-depend.html

Regards.

On Thu, 5 Apr 2007 07:41:06 +0100 (BST)
Ashish Karalkar [EMAIL PROTECTED] wrote:

 Hello , All 
   I want to see all the dependant object of a particular user,
   I know this must be present somewhere in information schema,catlog schema
   but realy cant figure out.
   can any one suggest?

   Thanks in advance
   Ashish
 
   
 -
  Here’s a new way to find what you're looking for - Yahoo! Answers 

---
Zongliang Quan
[EMAIL PROTECTED],[EMAIL PROTECTED]
Admin by
http://postgresql.oss.tw
http://postgresql-chinese.blogspot.com


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

   http://www.postgresql.org/docs/faq


Re: [GENERAL] Granting permissions

2007-04-05 Thread A. Kretschmer
am  Thu, dem 05.04.2007, um  7:59:11 +0100 mailte Ashish Karalkar folgendes:
 
 Even More is there any way to grant permission to a user on another database 
 ??

What do you want to do?


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: - Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

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


[GENERAL] All objects of a Particular USER

2007-04-05 Thread Ashish Karalkar
Hello , All 
  I want to see all the dependant object of a particular user,
  I know this must be present somewhere in information schema,catlog schema
  but realy cant figure out.
  can any one suggest?
   
  Thanks in advance
  Ashish


-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[GENERAL] Migrating data from mssql to postgresql

2007-04-05 Thread M. Nejat AYDIN

How can I migrate data from mssql to postgresql?

I have researched in the mailing list archives
and found some information. Some of them is related
to migration wizard tool, which is, I believe, a
plugin running on the pgadmin. But the current version
of pgadmin does not contain it (or I could not find it).
Is there any actual tool for this purpose ?

Thanks in advance.

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


Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar
Hi,
  I want to give only select,insert,update,delete permission on a particular 
database to a user. and aslso this user should not have any createdb permission.
  With Regards
  Ashish...

A. Kretschmer [EMAIL PROTECTED] wrote:
  am Thu, dem 05.04.2007, um 7:59:11 +0100 mailte Ashish Karalkar folgendes:
 
 Even More is there any way to grant permission to a user on another database 
 ??

What do you want to do?


Andreas
-- 
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

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



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

Re: [GENERAL] Migrating data from mssql to postgresql

2007-04-05 Thread Shoaib Mir

You can use the MSSQL DTS wizard for that purpose and using PostgreSQL ODBC
connector for target database connectivity there.

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 4/5/07, M. Nejat AYDIN [EMAIL PROTECTED] wrote:


How can I migrate data from mssql to postgresql?

I have researched in the mailing list archives
and found some information. Some of them is related
to migration wizard tool, which is, I believe, a
plugin running on the pgadmin. But the current version
of pgadmin does not contain it (or I could not find it).
Is there any actual tool for this purpose ?

Thanks in advance.

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



Re: [GENERAL] Migrating data from mssql to postgresql

2007-04-05 Thread Zongliang, Quan
Try these:

http://pgfoundry.org/projects/my2postgres/
http://pgfoundry.org/projects/mysql2pgsql/

Regards.

On Thu, 05 Apr 2007 11:00:58 +0300
M. Nejat AYDIN [EMAIL PROTECTED] wrote:

 How can I migrate data from mssql to postgresql?
 
 I have researched in the mailing list archives
 and found some information. Some of them is related
 to migration wizard tool, which is, I believe, a
 plugin running on the pgadmin. But the current version
 of pgadmin does not contain it (or I could not find it).
 Is there any actual tool for this purpose ?
 
 Thanks in advance.
 
 ---(end of broadcast)---
 TIP 2: Don't 'kill -9' the postmaster

---
Zongliang Quan
[EMAIL PROTECTED],[EMAIL PROTECTED]
Admin by
http://postgresql.oss.tw
http://postgresql-chinese.blogspot.com


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

   http://www.postgresql.org/docs/faq


Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar
Hi,
  I want to give only select,insert,update,delete permission on a particular 
database to a user. and aslso this user should not have any createdb permission.
  With Regards
  Ashish...

A. Kretschmer [EMAIL PROTECTED] wrote:
  am Thu, dem 05.04.2007, um 7:59:11 +0100 mailte Ashish Karalkar folgendes:
 
 Even More is there any way to grant permission to a user on another database 
 ??

What do you want to do?


Andreas
-- 
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

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



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[GENERAL] Trigger on CREATE ROLE

2007-04-05 Thread Inoqulath

Hello List
Any chance to add a trigger-like behaviour on CREATE/DROP/ALTER ROLE?
PostgreSQL 8.1.5

Thx in Advance

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


Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar

Even More is there any way to grant permission to a user on another database ??
   
  With Regards
  Ashish
A. Kretschmer [EMAIL PROTECTED] wrote:
  am Wed, dem 04.04.2007, um 22:23:20 -0700 mailte Postgres User folgendes:
 Is there a way to grant INSERT and UPDATE permissions on all the
 tables in a database? I don't want to type-in every table name...

http://people.planetpostgresql.org/greg/index.php?/archives/38-Scripting-with-psql.html#extended


Andreas
-- 
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: - Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

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



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[GENERAL] Cron'd dumpall failing?

2007-04-05 Thread Kenneth Downs
I truly hoping I'm missing something silly here.  I've got a cron job to 
run a dumpall each early am.  It fails, and I get a handful of emails.  
The first reads like this:


pg_dump: [archiver (db)] connection to database adocs failed: FATAL:  sorry, 
too many clients already
pg_dumpall: pg_dump failed on database adocs, exiting


...and then as we go along we get this one repeating for each database:

pg_dump: WARNING:  out of shared memory
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  out of shared memory
HINT:  You may need to increase max_locks_per_transaction.
pg_dump: The command was: SELECT sequence_name, last_value, increment_by, CASE WHEN 
increment_by  0 AND max_value = 9223372036854775807 THEN NULL  WHEN increment_by 
 0 AND max_value = -1 THEN NULL  ELSE max_value END AS max_value, CASE WHEN 
increment_by  0 AND min_value = 1 THEN NULL  WHEN increment_by  0 AND min_value 
= -9223372036854775807 THEN NULL  ELSE min_value END AS min_value, cache_value, 
is_cycled, is_called from tabproj_skey
pg_dumpall: pg_dump failed on database X, exiting




The cron entry (for user root) is

* 1 * * * /root/dumpall.sh  /dev/null

and the routine in question is this:

pg_dumpall -U postgres   /home/bups/bsource/pg/dhost2.dumpall
chown bups:root /home/bups/bsource/pg/dhost2.dumpall
chmod 600   /home/bups/bsource/pg/dhost2.dumpall




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

  http://archives.postgresql.org/


Re: [GENERAL] All objects of a Particular USER

2007-04-05 Thread Alvaro Herrera
Zongliang, Quan escribió:
 See here:
 
 http://www.postgresql.org/docs/8.2/static/catalog-pg-depend.html

pg_shdepend is more appropriate in this case.


-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

   http://archives.postgresql.org/


Re: [GENERAL] Granting permissions

2007-04-05 Thread Albe Laurenz
 I want to give only select,insert,update,delete permission on 
 a particular database to a user. and aslso this user should 
 not have any createdb permission.

I think that you get the concept wrong.

You cannot select from a database, you can only select from a
table (or view).

You probably mean 'select permissions for all tables in a database'.

There is no such thing.
Permissions are stored on the objects themselves, so a table
knows who is allowed to access it.

For what you want, you must give the user
a) permissions on all individual tables he/she should access
b) USAGE privilege on the Schemata
c) CONNECT privilege to the database.

Yours,
Laurenz Albe

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


Re: [GENERAL] Granting permissions

2007-04-05 Thread Ashish Karalkar

Thanks Albe ,
  yes,database means all objects of that database.
  I will check this out.
  Thanks
  Ashish...
Albe Laurenz [EMAIL PROTECTED] wrote:
   I want to give only select,insert,update,delete permission on 
 a particular database to a user. and aslso this user should 
 not have any createdb permission.

I think that you get the concept wrong.

You cannot select from a database, you can only select from a
table (or view).

You probably mean 'select permissions for all tables in a database'.

There is no such thing.
Permissions are stored on the objects themselves, so a table
knows who is allowed to access it.

For what you want, you must give the user
a) permissions on all individual tables he/she should access
b) USAGE privilege on the Schemata
c) CONNECT privilege to the database.

Yours,
Laurenz Albe



-
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[GENERAL] inet_client_addr() implementation

2007-04-05 Thread J. ORIOL
Hello,

I was in the archives, looking for some concrete info about inet_client_addr() 
use, but only a C function found.

I have some clients to my app. (PG 8.2 in XP LAN). I want to generate auto-logs 
with trigger function for every table and for every event, but I cannot include 
clint ip address yet.

When the triggers starts and execute  SELECT  inet_client_addr(), will retrieve 
client's ip ?? or just 127.0.0.1

Some tips are very useful to me.

Thanks in advance.

Oriol M.


--
  J. Oriol Mujica F.
--
Bucaramanga - COLOMBIA
 __
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

Re: [GENERAL] inet_client_addr() implementation

2007-04-05 Thread Magnus Hagander
On Thu, Apr 05, 2007 at 07:57:41AM -0500, J. ORIOL wrote:
 Hello,
 
 I was in the archives, looking for some concrete info about 
 inet_client_addr() use, but only a C function found.
 
 I have some clients to my app. (PG 8.2 in XP LAN). I want to generate 
 auto-logs with trigger function for every table and for every event, but I 
 cannot include clint ip address yet.
 
 When the triggers starts and execute  SELECT  inet_client_addr(), will 
 retrieve client's ip ?? or just 127.0.0.1

It should return the clients IP.

(If you're using say a web-ap, that will be 127.0.0.1, since it can't know
where the browser is. But if the client does a direct connection to the
database, it should return it)

//Magnus


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

   http://archives.postgresql.org/


[GENERAL] Print database name

2007-04-05 Thread Woody Woodring
Is there a sql command to print out which database I am connected to?

I am using psql -f sqlFile in a sh script to up date tables on multiple
databases.  I would like to have the sqlFile display the db name so I would
know which output lines go with each db without having to count the output
lines.

Thanks,
Woody


iGLASS Networks
211-A S. Salem St
Apex NC 27502
(919) 387-3550 x813
www.iglass.net


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


Re: [GENERAL] Print database name

2007-04-05 Thread Michael Fuhr
On Thu, Apr 05, 2007 at 08:51:28AM -0400, Woody Woodring wrote:
 Is there a sql command to print out which database I am connected to?

SELECT current_database();

See System Information Functions in the documentation for other
such functions.

http://www.postgresql.org/docs/8.2/interactive/functions-info.html

-- 
Michael Fuhr

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


Re: [GENERAL] Using C# to create stored procedures

2007-04-05 Thread Tomi N/A

2007/4/3, Andrus [EMAIL PROTECTED]:


I needd to re-write a lot of compliatated SQL select statements to run them
in server which generate reports.
Currently they are running in client side.
Client application uses procedural language  to do additional processing of
data retrieved from PostgreSQL server.

I need to create new client application. So I desided that I must move as
much processing to server as possible.
Using C# should make my procedures portable to MS SQL, DB2 also.

I'm looking for things available in modern language IDEs like
auto-completion, intellisence, immediate syntax check
and modern language features like classes, generic, interfaces.
There a much more source code, resources and  books available in C# than in
pl/pgSQL.


So use pljava. And add refactoring and IDE independence on the
development side and platform independence on the deployment side,
while you're at it.
Or write a service layer and build upon it in whatever you want. Or
write plc# and make it possible for yourself and anyone else to write
postgresql procedures in C#.


C# allows to use whole .NET class library, which contains solutions for
almost everything.


...rrright. ;^)


I think that using pgAdmin+PL/pgSQL decreases my productivity a lot compared
to Visual Studio + C#


I would tend to agree with you there: writing major chunks of logic in
stored procedures (plpgsql, tsql or any other SQLoid language) isn't a
very pleasurable experiance...but it feels like a death row pardon
compared to debugging someone elses SQLoid code.

Cheers,
t.n.a.

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

  http://archives.postgresql.org/


Re: [GENERAL] Problem with oids for table names getting out of sync?

2007-04-05 Thread omar


SELECT relfilenode, relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' 
AND relkind = 'r'


Oid o = PQftable(_res, i);
  


Um ... are you laboring under some delusion about relfilenode being the
same as relation OID?

  
Apparently I am.  libpq docs claim that You can query the system table 
pg_class to determine exactly which table is referenced. for PQftable.  
I query pg_class and the only column that looks remotely like a unique 
oid is relfilenode.  The other thing is that it works most of the time 
and starts to work again when I dump and restore.


Thanks


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


Re: [GENERAL] Print database name

2007-04-05 Thread Jaime Silvela
I know you've probably discussed this in many places, but I have a crash 
right now I need to recover from, and I'm not finding documentation that 
fast.

Where should I go?

Below you can see the log on starting, after a kill -9 of a process 
brought Postgres down.
After letting postgres run for a while, it seems to have fixed itself, 
and now the log does not suggest any corruption, and I can access it 
locally. However, TCP/IP connections are rejected. Any ideas?

Is there a page/s with information on quick recovery after corruption?

LOG:  could not create IPv6 socket: Address family not supported by 
protocol
LOG:  database system was interrupted while in recovery at 2007-04-05 
08:18:47 EDT
HINT:  This probably means that some data is corrupted and you will have 
to use the last backup for recovery.






***
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.

Bear Stearns does not provide tax, legal or accounting advice.  You
should consult your own tax, legal and accounting advisors before
engaging in any transaction. In order for Bear Stearns to comply with
Internal Revenue Service Circular 230 (if applicable), you are notified
that any discussion of U.S. federal tax issues contained or referred to
herein is not intended or written to be used, and cannot be used, for
the purpose of:  (A) avoiding penalties that may be imposed under the
Internal Revenue Code; nor (B) promoting, marketing or recommending to
another party any transaction or matter addressed herein.
***

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

  http://www.postgresql.org/docs/faq


Re: [GENERAL] Using C# to create stored procedures

2007-04-05 Thread Scott Ribe
 Awhile back I read an article claiming that .NET could only host one
 language, or at least only languages that differed merely in trivial
 syntactic details --- its execution engine isn't flexible enough for
 anything truly interesting.  Haven't looked into that for myself
 though ... any comments?

Well, I've heard it only really supports single-dispatch style of OO, so
Common Lisp/Dylan type object models are not well supported.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice



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


Re: [GENERAL] Problem with oids for table names getting out of sync?

2007-04-05 Thread Alvaro Herrera
omar wrote:
 
 SELECT relfilenode, relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' 
 AND relkind = 'r'
 
 Oid o = PQftable(_res, i);
   
 
 Um ... are you laboring under some delusion about relfilenode being the
 same as relation OID?
 
   
 Apparently I am.  libpq docs claim that You can query the system table 
 pg_class to determine exactly which table is referenced. for PQftable.  
 I query pg_class and the only column that looks remotely like a unique 
 oid is relfilenode.

select oid, relname from pg_class where ...

relfilenode is just the file name given to the table, which is the same
as the OID when the table is just created, but changes after certain
operations (CLUSTER, TRUNCATE, REINDEX for indexes, maybe others)

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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

   http://archives.postgresql.org/


[GENERAL] Crash recovery

2007-04-05 Thread Jaime Silvela

Apologies for the duplication - I've been having email problems.

Jaime Silvela wrote:
I know you've probably discussed this in many places, but I have a 
crash right now I need to recover from, and I'm not finding 
documentation that fast.

Where should I go?

Below you can see the log on starting, after a kill -9 of a process 
brought Postgres down.
After letting postgres run for a while, it seems to have fixed itself, 
and now the log does not suggest any corruption, and I can access it 
locally. However, TCP/IP connections are rejected. Any ideas?

Is there a page/s with information on quick recovery after corruption?

LOG:  could not create IPv6 socket: Address family not supported by 
protocol
LOG:  database system was interrupted while in recovery at 2007-04-05 
08:18:47 EDT
HINT:  This probably means that some data is corrupted and you will 
have to use the last backup for recovery.








***
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.

Bear Stearns does not provide tax, legal or accounting advice.  You
should consult your own tax, legal and accounting advisors before
engaging in any transaction. In order for Bear Stearns to comply with
Internal Revenue Service Circular 230 (if applicable), you are notified
that any discussion of U.S. federal tax issues contained or referred to
herein is not intended or written to be used, and cannot be used, for
the purpose of:  (A) avoiding penalties that may be imposed under the
Internal Revenue Code; nor (B) promoting, marketing or recommending to
another party any transaction or matter addressed herein.
***

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


Re: [GENERAL] Cron'd dumpall failing?

2007-04-05 Thread Tom Lane
Kenneth Downs [EMAIL PROTECTED] writes:
 pg_dump: [archiver (db)] connection to database adocs failed: FATAL:  
 sorry, too many clients already

you need to increase max_connections and/or superuser_reserved_connections

 pg_dump: Error message from server: ERROR:  out of shared memory
 HINT:  You may need to increase max_locks_per_transaction.

you need to increase max_locks_per_transaction

regards, tom lane

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


Re: [GENERAL] Problem with oids for table names getting out of sync?

2007-04-05 Thread Omar Eljumaily
Alvaro and Tom, thanks so much.  I was getting worried that I was going 
to have to ask my customers to dump and restore periodically, ugh.  I 
think I need to learn a bit more about postgresql internals to help me 
with my project.  Not thinking about selecting for oids is kind of 
embarrassing.


Thanks,

Omar

Alvaro Herrera wrote:

omar wrote:
  
SELECT relfilenode, relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' 
AND relkind = 'r'
   


   Oid o = PQftable(_res, i);
 


Um ... are you laboring under some delusion about relfilenode being the
same as relation OID?

 
  
Apparently I am.  libpq docs claim that You can query the system table 
pg_class to determine exactly which table is referenced. for PQftable.  
I query pg_class and the only column that looks remotely like a unique 
oid is relfilenode.



select oid, relname from pg_class where ...

relfilenode is just the file name given to the table, which is the same
as the OID when the table is just created, but changes after certain
operations (CLUSTER, TRUNCATE, REINDEX for indexes, maybe others)

  



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


Re: [GENERAL] Print database name

2007-04-05 Thread Tom Lane
Jaime Silvela [EMAIL PROTECTED] writes:
 Below you can see the log on starting, after a kill -9 of a process 
 brought Postgres down.
 After letting postgres run for a while, it seems to have fixed itself, 
 and now the log does not suggest any corruption, and I can access it 
 locally. However, TCP/IP connections are rejected. Any ideas?

1. Please do not hijack existing threads for an unrelated question.

2. You must have changed postgresql.conf or pg_hba.conf to reject
outside connections.  This might have happened some time ago and only
shown up upon postmaster restart, if you'd neglected to SIGHUP the
postmaster after the change...

regards, tom lane

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


Re: [GENERAL] OS X Kernel settings

2007-04-05 Thread Scott Ribe
 I'm not sure whether Apple has fixed the
 bug in the startup script, where the external file was referred AFTER
 the values where set.

Yes. You can now edit /etc/sysctl.conf and nothing else is required. I
learned this ~10.4.8, so I don't know when it actually happened.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice



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

   http://www.postgresql.org/docs/faq


Re: [GENERAL] Print database name

2007-04-05 Thread Jaime Silvela
1. Sorry, that was an accident. I sent a new thread to the list and it 
didn't make it. Thinking I had gotten the address wrong, I replied to 
this thread and accidentally hit send, forgetting to change the subject. 
My apologies, no hijacking was intended.


2. Close. The database was generally restarted with a script that would 
call postmaster with the -i option. The conf file never allowed TCP/IP 
connections, which didn't become apparent until I tried to restart using 
pg_ctl with no options.


Thank you , and sorry again
Jaime

Tom Lane wrote:

Jaime Silvela [EMAIL PROTECTED] writes:
  
Below you can see the log on starting, after a kill -9 of a process 
brought Postgres down.
After letting postgres run for a while, it seems to have fixed itself, 
and now the log does not suggest any corruption, and I can access it 
locally. However, TCP/IP connections are rejected. Any ideas?



1. Please do not hijack existing threads for an unrelated question.

2. You must have changed postgresql.conf or pg_hba.conf to reject
outside connections.  This might have happened some time ago and only
shown up upon postmaster restart, if you'd neglected to SIGHUP the
postmaster after the change...

regards, tom lane

  



***
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.

Bear Stearns does not provide tax, legal or accounting advice.  You
should consult your own tax, legal and accounting advisors before
engaging in any transaction. In order for Bear Stearns to comply with
Internal Revenue Service Circular 230 (if applicable), you are notified
that any discussion of U.S. federal tax issues contained or referred to
herein is not intended or written to be used, and cannot be used, for
the purpose of:  (A) avoiding penalties that may be imposed under the
Internal Revenue Code; nor (B) promoting, marketing or recommending to
another party any transaction or matter addressed herein.
***

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


Re: [GENERAL] inet_client_addr() implementation

2007-04-05 Thread J. ORIOL
Thanks Magnus,

I have working my triggers, just with 127.0.0.1, soon I'll make tests with LAN 
clients.

Best regards.

Magnus Hagander [EMAIL PROTECTED] escribió: On Thu, Apr 05, 2007 at 
07:57:41AM -0500, J. ORIOL wrote:
 Hello,
 
 I was in the archives, looking for some concrete info about 
 inet_client_addr() use, but only a C function found.
 
 I have some clients to my app. (PG 8.2 in XP LAN). I want to generate 
 auto-logs with trigger function for every table and for every event, but I 
 cannot include clint ip address yet.
 
 When the triggers starts and execute  SELECT  inet_client_addr(), will 
 retrieve client's ip ?? or just 127.0.0.1

It should return the clients IP.

(If you're using say a web-ap, that will be 127.0.0.1, since it can't know
where the browser is. But if the client does a direct connection to the
database, it should return it)

//Magnus




--
  J. Oriol Mujica F.
--
Bucaramanga - COLOMBIA
 __
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

Re: [GENERAL] OS X Kernel settings

2007-04-05 Thread Guido Neitzer

On 05.04.2007, at 09:09, Scott Ribe wrote:


Yes. You can now edit /etc/sysctl.conf and nothing else is required. I
learned this ~10.4.8, so I don't know when it actually happened.


Okay, that's good. They had the wrong order of commands before, so  
that the values in /etc/rc were used and not the values from the  
external file. That was a bug in the script.


cug

---(end of broadcast)---
TIP 1: 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] Storing blobs in PG DB

2007-04-05 Thread Naz Gassiep
This doesn't answer your question, but I thought I'd throw my opinion in 
anyway.


My personal view is that in general, binary files have no place in 
databases. Filesystems are for files, databases are for data. My design 
choice is to store the files in a fileystem and use the database to hold 
metadata as well as a pointer to the file.


If you *must* put files into the database, then you can do so, and PG 
will handle that many files of those sizes with ease. For all intents 
and purposes, PG can store an unlimited number of files. You're far more 
likely to run into walls in the form of limitations in your disk I/O 
system then limitations in what PG will handle.


- Naz.

Nikolay Moskvichev wrote:

Hi All!

Question is : How suitable PG for storing about 2 000 000 binary files 
0,5-2,0 Mb size each ? It is not planned the big number of clients or 
a plenty of updatings. Like photoalbum on local host.


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

  http://www.postgresql.org/docs/faq



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

  http://archives.postgresql.org/


Re: [GENERAL] Using C# to create stored procedures

2007-04-05 Thread Postgres User

Andrus,

As a C# developer myself, I'd recommend learning pl/pg sql for
writring stored procs.  It's designed specifically for the kinds of
iterations and other operations you need when hanlding a recordset.
It's nothing like transact-sql of SQL Server.

If you must have full C# integration, then you're better off with SQL
Server 2005.

By the way, .NET LINQ will make most of your current thinking
irrelevant in about 12 months.

On 4/2/07, Andrus [EMAIL PROTECTED] wrote:

Last change for this project was 3 years ago.
So I think that it is dead.

I'm writing application in C#.
I expected that I can wrote stored procedures in C# also using something
like mod_mono  in Apache.

So it seems that most reasonable way is to learn dreaded plpgsql language
and write
stored procedures in it.

Andrus.


 Any idea how to write server-side stored procedures in C#  for
 PostgreSQL database ?

 There's an old project called PL/Mono
 http://gborg.postgresql.org/project/plmono/projdisplay.php, but as
 far as I know it's unmaintained.  You might want to try to contact the
 author. :)

 Cheers,
 David.

 In windows .NET 2 framework should be used and in Linuc/Mac/Windows
 MONO should be used for this.

 How to install MONO engine as server-side language to PostgreSQL ?

 How to call .NET dlls from PostgreSQL stored procedure ?


 Andrus.


 ---(end of broadcast)---
 TIP 1: 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

 --
 David Fetter [EMAIL PROTECTED] http://fetter.org/
 phone: +1 415 235 3778AIM: dfetter666
  Skype: davidfetter

 Remember to vote!
 Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

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



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

  http://archives.postgresql.org/



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

  http://www.postgresql.org/docs/faq


Re: [GENERAL] Anyone know where I can get an 8.2.3 binary for ubuntu?

2007-04-05 Thread Michelle Konzack
Am 2007-04-01 12:05:44, schrieb Leonel:
 and once you downloaded the packages do a :
 
 apt-get build-deps  postgresql-8.1

Are you sure?  --  It should be:

apt-get build-deps  postgresql-8.2

 then
 
 dpkg-source -x postgresql-8.2_8.2.3-2.dsc
 cd postgresql-8.2-8.2.3

cd postgresql-8.2

 edit  debian/control   and  put the dapper's version for  debhelper  and  
 cdbs
 dpkg-buildpackage -us -nc

dpkg-buildpackage -us -nc -rfakeroot

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [GENERAL] Tsearch2 crashes my backend, ouch !

2007-04-05 Thread Michelle Konzack
Hello Teodor,

Am 2007-03-30 16:49:19, schrieb Teodor Sigaev:
 Our tsearch_core patch (moving tsearch into core of pgsql) solves that 
 problem - it contains all possible snowball stemmers.

I have problems migrating my 7.4 to 8.2 since Debian contain only 8.1.
Applaying tsearch2 is strange too.

Where can I get the tsearch_core patch patch?


Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[GENERAL] Seg fault in pg_dump?

2007-04-05 Thread Michael Nolan

I get a segmentation fault in pg_dump (8.2.3 on a Linux Fedora Core 5
system) when dumping some (but not all) of the sequences in the public
schema:.

Here's the output from /usr/local/pgsql/bin/pg_dump -v -t
uscf_dues_dues_key_seq -U postgres uscf uscf_dues_dues_key_seq.seq

pg_dump: reading schemas
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined conversions
pg_dump: reading user-defined tables
pg_dump: reading table inheritance information
pg_dump: reading rewrite rules
pg_dump: reading type casts
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: flagging inherited columns in subtables
pg_dump: reading indexes
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading dependency data
pg_dump: saving encoding = SQL_ASCII
pg_dump: saving standard_conforming_strings = off
./seq.job: line 1: 31367 Segmentation fault
/usr/local/pgsql/bin/pg_dump -v
-t uscf_dues_dues_key_seq -U postgres uscf uscf_dues_dues_key_seq.seq

Any ideas what to try?
--
Mike Nolan


[GENERAL] turn off cache option

2007-04-05 Thread jungmin shin

Hello,


I'm executing a query invoking a UDF.
It looks that Postgres use a cache for executing UDFs.

For example,

select a()

a is a UDF.

Excution time of above statement is different each time.
What is happening inside of the Postgres when I invoke a UDF in a query?

It is taking 200ms or 11688ms .
There is huge differences.

If a cache is used for this execution , can I turn off the cache option?

Thanks,



--
Jungmin Shin


Re: [GENERAL] Seg fault in pg_dump?

2007-04-05 Thread Alvaro Herrera
Michael Nolan escribió:

 /usr/local/pgsql/bin/pg_dump -v
 -t uscf_dues_dues_key_seq -U postgres uscf uscf_dues_dues_key_seq.seq
 
 Any ideas what to try?

Here's one: get a backtrace from GDB.  Here, I get this error:

$ LC_ALL=C pg_dump -v -t uscf_dues_dues_key_seq -U alvherre uscf
pg_dump: No matching tables were found
pg_dump: *** aborted because of error

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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


Re: [GENERAL] Storing blobs in PG DB

2007-04-05 Thread Listmail


My personal view is that in general, binary files have no place in  
databases. Filesystems are for files, databases are for data. My design  
choice is to store the files in a fileystem and use the database to hold  
metadata as well as a pointer to the file.


If you *must* put files into the database, then you can do so, and PG  
will handle that many files of those sizes with ease. For all intents  
and purposes, PG can store an unlimited number of files. You're far more  
likely to run into walls in the form of limitations in your disk I/O  
system then limitations in what PG will handle.


And you can't backup with rsync...

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


Re: [GENERAL] Seg fault in pg_dump?

2007-04-05 Thread Michael Nolan

GDB produces:

Program received signal SIGSEGV, Segmentation fault.
0x0804fd6f in dumpSequence ()

The sequence definitely exists and works:

select * from uscf_dues_dues_key_seq
;
sequence_name  | last_value | increment_by |  max_value  |
min_
value | cache_value | log_cnt | is_cycled | is_called
++--+-+-
--+-+-+---+---
uscf_dues_dues_key_seq | 58 |1 | 9223372036854775807 |
   1 |   1 |   0 | f | t
(1 row)
--
Mike Nolan


Re: [GENERAL] Print database name

2007-04-05 Thread Martijn van Oosterhout
On Thu, Apr 05, 2007 at 11:17:49AM -0400, Jaime Silvela wrote:
 1. Sorry, that was an accident. I sent a new thread to the list and it 
 didn't make it. Thinking I had gotten the address wrong, I replied to 
 this thread and accidentally hit send, forgetting to change the subject. 
 My apologies, no hijacking was intended.

Umm, changing the subject doesn't make a new thread. It looks like it
does in some mailers, but it doesn't actually...

Have a nice day,
-- 
Martijn van Oosterhout   kleptog@svana.org   http://svana.org/kleptog/
 From each according to his ability. To each according to his ability to 
 litigate.


signature.asc
Description: Digital signature


Re: [GENERAL] Storing blobs in PG DB

2007-04-05 Thread Merlin Moncure

On 4/5/07, Listmail [EMAIL PROTECTED] wrote:


 My personal view is that in general, binary files have no place in
 databases. Filesystems are for files, databases are for data. My design
 choice is to store the files in a fileystem and use the database to hold
 metadata as well as a pointer to the file.

 If you *must* put files into the database, then you can do so, and PG
 will handle that many files of those sizes with ease. For all intents
 and purposes, PG can store an unlimited number of files. You're far more
 likely to run into walls in the form of limitations in your disk I/O
 system then limitations in what PG will handle.

And you can't backup with rsync...


no, but you can do incrementals with PITR, which is just as good (if
not better) than rsync because you are backing up your database
'indexer' and binaries in one swoop...so the backup argument doesn't
fly, imo.

imo, sql is a richer language for storing and extracting any type of
data, binaries included, than hierarchal filesystem style
organization.  I think most reasons why not to store binaries in the
database boil down to performance.

merlin

---(end of broadcast)---
TIP 1: 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] Storing blobs in PG DB

2007-04-05 Thread Thomas Kellerer

Merlin Moncure wrote on 05.04.2007 23:24:

I think most reasons why not to store binaries in the
database boil down to performance.


Having implemented an application where the files were stored in the filesystem 
instead of the database I have to say, with my experience I would store the 
files in the DB the next time. Once the number of files in a directory exceeds a 
certain limit, this directory is very hard to handle.


Things like dir, or ls or listing the contents through a FTP connection 
become extremely slow (using HP/UX as well as Windows).


And you have to backup only _one_ source (the database), not two. Moving the 
data around from system a to system b (e.g. staging (windows) - production 
(HP/UX)) is a lot easier when you can simply backup and restore the database (in 
our case it was an Oracle database, but this would be the same for PG)


Thomas


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


RES: [GENERAL] Order by behaviour

2007-04-05 Thread Carlos H. Reimer
Hi,

I was trying to find the docs about the collating sequence standards but
could not find.

Would like to know for example which characters are ignored by the order
by in some of the collating types.

Please, can anyone indicate me where could I find documentation about these
standards?

Thanks in advance!

 -Mensagem original-
 De: Stephan Szabo [mailto:[EMAIL PROTECTED]
 Enviada em: quarta-feira, 28 de março de 2007 19:23
 Para: Carlos H. Reimer
 Cc: pgsql-general@postgresql.org
 Assunto: Re: [GENERAL] Order by behaviour


 On Wed, 28 Mar 2007, Carlos H. Reimer wrote:

  Hi,
 
  We have a PostgreSQL 8.0.6 cluster configured with
 lc_collate=pt_BR.UTF-8
  and when we run the following SELECT:
  SELECT substr(nomerazao,1,4),
  ascii(substr(nomerazao,1,1)),
  ascii(substr(nomerazao,2,1))
  from spunico.unico order by nomerazao;
 
  is returning:
 
   substr | ascii | ascii
  +---+---
  |32 | 0
  |32 | 0
   1000   |49 |48
   1.DI   |49 |46
   1° R   |49 |   176
   2M C   |50 |77
   3A.G   |51 |65
   A. A   |65 |46
   AABA   |65 |65
   A.A.   |65 |46
   A.AG   |65 |46
   A.A.   |65 |46
   A.A.   |65 |46
   ABAS   |65 |66
   ABAS   |65 |66
   ABAT   |65 |66
   A.B.   |65 |46
   A.B.   |65 |46
   ABCC   |65 |66
   A.B.   |65 |46
   A.B.   |65 |46
 
  Are not the lines out of order or is it a normal behaviour for
 a server with
  lc_collate=pt_BR.UTF-8?

 Many collations ignore spaces and symbols on the first pass, so, for
 example you might have A Z  AB despite the fact that a space has a
 lower value than a B.




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


Re: [GENERAL] Seg fault in pg_dump?

2007-04-05 Thread Alvaro Herrera
Michael Nolan escribió:
 GDB produces:
 
 Program received signal SIGSEGV, Segmentation fault.
 0x0804fd6f in dumpSequence ()

Not very helpful -- what does it say if you ask for bt?  I'm thinking
this is not a debug-enabled build though.  I think you have to install a
separate RPM package in Fedora to get the debug symbols.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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


Re: [GENERAL] Storing blobs in PG DB

2007-04-05 Thread William Garrison
I have actually never stored data in the database.  But in a recent 
project I've realized it might have been smart.  We store a terabytes of 
data on the file system, and many times I would love to have an ACID 
compliant file system.  For example, if I delete an entry, I need to 
delete it from disk and from the database.  How can I be sure that was 
transactional?  Or if I append data to the file, and then update the 
database.  What then?  I wind-up writing tricky code that does stuff 
like renames a file, updates the DB, and renames it back if there is an 
error in an attempt to fake-out atomicity and transactions.


Of course, I may have come-up with even more issues if the company put 
this data into a SQL server.  Who knows.


Where exactly does PostgreSQL put large blobs?  Does it ensure ACID 
compliance if I add a 2GB blob in a column?


Merlin Moncure wrote:

On 4/5/07, Listmail [EMAIL PROTECTED] wrote:


 My personal view is that in general, binary files have no place in
 databases. Filesystems are for files, databases are for data. My design
 choice is to store the files in a fileystem and use the database to 
hold

 metadata as well as a pointer to the file.

 If you *must* put files into the database, then you can do so, and PG
 will handle that many files of those sizes with ease. For all intents
 and purposes, PG can store an unlimited number of files. You're far 
more

 likely to run into walls in the form of limitations in your disk I/O
 system then limitations in what PG will handle.

And you can't backup with rsync...


no, but you can do incrementals with PITR, which is just as good (if
not better) than rsync because you are backing up your database
'indexer' and binaries in one swoop...so the backup argument doesn't
fly, imo.

imo, sql is a richer language for storing and extracting any type of
data, binaries included, than hierarchal filesystem style
organization.  I think most reasons why not to store binaries in the
database boil down to performance.

merlin

---(end of broadcast)---
TIP 1: 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




---(end of broadcast)---
TIP 1: 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] Sort and Limit - really nasty query and feature of the day

2007-04-05 Thread Listmail


	Today I rewrote a particularly nasty query involving a UNION ALL between  
an active table and a huge archive table, some left joins, order by and  
limit, and it went from 5 minutes to under one second ; however one query  
became 4 with some glue in between.


EXPLAIN
SELECT * FROM (
SELECT 0 AS archived, id, price, surface, coords, detect_time, type_id,  
vente, zipcode, city_id, description FROM annonces

UNION ALL
SELECT 1 AS archived, a.id, price, surface, coords, detect_time, type_id,  
vente, zipcode, city_id, description FROM archive_data a LEFT JOIN  
archive_ext d ON a.id=d.id ) AS foo

WHERE
detect_time = '2006-10-30 16:17:45.064793'
	AND type_id IN  
(1,12,24,17,18,19,20,33,35,50,51,7,52,4,13,41,14,16,26,28,43,53,15,29,30,31,45,32,34,46,47,6)

AND vente
	AND (zipcode IN (69001,69002,69003,69004,69005,69006,69007,69008,69009)  
OR city_id IN (27595) OR coords   
'(45.74101689082,4.8371263505564),(45.75898310918,4.8628736494436)'::BOX)

AND surface IS NOT NULL AND price IS NOT NULL
ORDER BY price/surface
LIMIT 100;

Here is the messy explain :

 Limit  (cost=333560.35..333560.60 rows=100 width=103)
   -  Sort  (cost=333560.35..333656.88 rows=38610 width=103)
 Sort Key: (foo.price / (foo.surface)::double precision)
 -  Result  (cost=133.21..328438.41 rows=38610 width=103)
   -  Append  (cost=133.21..328245.36 rows=38610 width=103)
 -  Bitmap Heap Scan on annonces   
(cost=133.21..7520.56 rows=1426 width=190)
   Recheck Cond: ((vente AND (zipcode = ANY  
('{69001,69002,69003,69004,69005,69006,69007,69008,69009}'::integer[])))  
OR (vente AND (city_id = 27595)) OR (coords   
'(45.75898310918,4.8628736494436),(45.74101689082,4.8371263505564)'::box))
   Filter: ((detect_time = '2006-10-30  
16:17:45.064793'::timestamp without time zone) AND (type_id = ANY  
('{1,12,24,17,18,19,20,33,35,50,51,7,52,4,13,41,14,16,26,28,43,53,15,29,30,31,45,32,34,46,47,6}'::integer[]))  
AND vente AND (surface IS NOT NULL) AND (price IS NOT NULL))
   -  BitmapOr  (cost=133.21..133.21 rows=4294  
width=0)
 -  Bitmap Index Scan on annonces_zip   
(cost=0.00..55.91 rows=1761 width=0)
   Index Cond: ((vente = true) AND  
(zipcode = ANY  
('{69001,69002,69003,69004,69005,69006,69007,69008,69009}'::integer[])))
 -  Bitmap Index Scan on annonces_city   
(cost=0.00..42.85 rows=1859 width=0)
   Index Cond: ((vente = true) AND  
(city_id = 27595))
 -  Bitmap Index Scan on annonces_coords   
(cost=0.00..33.37 rows=675 width=0)
   Index Cond: (coords   
'(45.75898310918,4.8628736494436),(45.74101689082,4.8371263505564)'::box)
 -  Merge Right Join  (cost=59679.03..320338.70  
rows=37184 width=182)

   Merge Cond: (d.id = a.id)
   -  Index Scan using archive_ext_pkey on  
archive_ext d  (cost=0.00..252661.12 rows=2976314 width=119)
   -  Sort  (cost=59679.03..59771.99 rows=37184  
width=67)

 Sort Key: a.id
 -  Bitmap Heap Scan on archive_data a   
(cost=3951.02..56856.32 rows=37184 width=67)
   Recheck Cond: ((vente AND (zipcode  
= ANY  
('{69001,69002,69003,69004,69005,69006,69007,69008,69009}'::integer[])))  
OR (vente AND (city_id = 27595)) OR (coords   
'(45.75898310918,4.8628736494436),(45.74101689082,4.8371263505564)'::box))
   Filter: ((detect_time =  
'2006-10-30 16:17:45.064793'::timestamp without time zone) AND (type_id =  
ANY  
('{1,12,24,17,18,19,20,33,35,50,51,7,52,4,13,41,14,16,26,28,43,53,15,29,30,31,45,32,34,46,47,6}'::integer[]))  
AND vente AND (surface IS NOT NULL) AND (price IS NOT NULL))
   -  BitmapOr   
(cost=3951.02..3951.02 rows=171699 width=0)
 -  Bitmap Index Scan on  
archive_data_zip  (cost=0.00..1692.62 rows=80610 width=0)
   Index Cond: ((vente =  
true) AND (zipcode = ANY  
('{69001,69002,69003,69004,69005,69006,69007,69008,69009}'::integer[])))
 -  Bitmap Index Scan on  
archive_data_city  (cost=0.00..1695.31 rows=80683 width=0)
   Index Cond: ((vente =  
true) AND (city_id = 27595))
 -  Bitmap Index Scan on  
archive_data_coords  (cost=0.00..535.20 rows=10406 width=0)
   Index Cond: (coords   
'(45.75898310918,4.8628736494436),(45.74101689082,4.8371263505564)'::box)


	I didn't redo the explain analyze, it takes too 

Re: [GENERAL] Storing blobs in PG DB

2007-04-05 Thread Thomas Kellerer

William Garrison wrote on 06.04.2007 00:22:
I have actually never stored data in the database. 


Hmm, funny statement somehow ;)


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


[GENERAL] Migrate postgres DB to oracle

2007-04-05 Thread bcochofel
I need some help to migrate a postgres DB (v7.4) to oracle.
His there any tools, SW, scripts or something to help me with the job?

Thanks,
Bruno


---(end of broadcast)---
TIP 1: 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] Anyone know where I can get an 8.2.3 binary for ubuntu?

2007-04-05 Thread Leonel

On 4/5/07, Michelle Konzack [EMAIL PROTECTED] wrote:

Am 2007-04-01 12:05:44, schrieb Leonel:
 and once you downloaded the packages do a :

 apt-get build-deps  postgresql-8.1

Are you sure?  --  It should be:




You don't have the  build-dep  for  8.2 in ubuntu  dapper/ edgy


apt-get build-deps  postgresql-8.2


First is   apt-get build-depnot  deps
and  this is what you get  when trying to get the build-dep  for  8.2 :

E: Build-Depends dependency for postgresql-8.2 cannot be satisfied
because no available versions of package debhelper can satisfy version
requirements




 then

 dpkg-source -x postgresql-8.2_8.2.3-2.dsc
 cd postgresql-8.2-8.2.3

cd postgresql-8.2


again  no

after  you  run dpkg-source   you don't  get  a  postgresql-8.2
directory  you get  a  postgresql-8.2-8.2.3





 edit  debian/control   and  put the dapper's version for  debhelper  and
 cdbs
 dpkg-buildpackage -us -nc

dpkg-buildpackage -us -nc -rfakeroot

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)





--
Leonel

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

  http://archives.postgresql.org/


Re: [GENERAL] Migrate postgres DB to oracle

2007-04-05 Thread mmara
- Mensaje original -
De: bcochofel [EMAIL PROTECTED]
Fecha: Jueves, Abril 5, 2007 7:46 pm
Asunto: [GENERAL] Migrate postgres DB to oracle

 I need some help to migrate a postgres DB (v7.4) to oracle.
 His there any tools, SW, scripts or something to help me with the job?
 
 Thanks,
 Bruno
 
 
You're asking in the wrong place (not because nobody can help, because it's not 
polite, you should search oracle's forums).
Anyway, see if someone over here 
(http://www.oracle.com/technology/tech/migration/mti/index.html) can help you 
out.




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


Re: [GENERAL] Anyone know where I can get an 8.2.3 binary for ubuntu?

2007-04-05 Thread Listmail



On 4/5/07, Michelle Konzack [EMAIL PROTECTED] wrote:

Am 2007-04-01 12:05:44, schrieb Leonel:
 and once you downloaded the packages do a :

 apt-get build-deps  postgresql-8.1

Are you sure?  --  It should be:




You don't have the  build-dep  for  8.2 in ubuntu  dapper/ edgy


	I recently installed kubuntu and postgres 8.2.3 is available in apt-get  
(edgy backports I think).


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


Re: [GENERAL] turn off cache option

2007-04-05 Thread Ragnar
On fim, 2007-04-05 at 16:31 -0400, jungmin shin wrote:
  
 I'm executing a query invoking a UDF.
 It looks that Postgres use a cache for executing UDFs.

Postgresql is not using a cache specially for executing
UDFs, apart from only compiling the function once for each
session.

  
 select a()
 Excution time of above statement is different each time.
 What is happening inside of the Postgres when I invoke a UDF in a
 query?
  
 It is taking 200ms or 11688ms .

Postgresql relies on the filesystem and operating
system to cache fisk buffers efficiently, so you are probably
just seeing the effects of that, assuming that your function is
doing the same thing each time. 

  
 If a cache is used for this execution , can I turn off the cache
 option?

why would you want to do that?

gnari



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


Re: [GENERAL] Storing blobs in PG DB

2007-04-05 Thread William Garrison

lol.

yeah, I meant binary blobs. :-)

Thomas Kellerer wrote:

William Garrison wrote on 06.04.2007 00:22:
I have actually never stored data in the database. 


Hmm, funny statement somehow ;)


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




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


Re: [GENERAL] ERROR: out of shared memory

2007-04-05 Thread Joseph S

Try doing select * from pg_locks to see how many locks you have out.

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


[GENERAL] problem selecting from function

2007-04-05 Thread Rikard Pavelic

Hi!

Can someone help me with this problem.

When I select from this function I get an error

ERROR: record red has no field id
SQL state: 42703
Context: PL/pgSQL function select_ex1 line 4 at assignment

Here is the code

create table example1(
id serial primary key,
name1 varchar(10),
value1 int);

insert into example1 values(1,'abc',2);
insert into example1 values(3,'def',5);

create function select_ex1(out id int, out name1 varchar, out value1 
int) returns setof record as

$$
declare red record;
begin
   for red in select id, name1, value1 from example1 LOOP
   id=red.id;
   name1=red.name1;
   value1=red.value1;
   return next;
   end LOOP;
end
$$ language plpgsql;

and
select * from select_ex1();

It seems to me that postgres doesn't like returning parameter name
and if I change function to
create function select_ex1(out id1 int, out name2 varchar, out value2 int)
then everything is ok.

Regards,
Rikard

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


Re: [GENERAL] Migrating data from mssql to postgresql

2007-04-05 Thread David Fetter
On Thu, Apr 05, 2007 at 11:00:58AM +0300, M. Nejat AYDIN wrote:
 How can I migrate data from mssql to postgresql?
 
 I have researched in the mailing list archives and found some
 information. Some of them is related to migration wizard tool,
 which is, I believe, a plugin running on the pgadmin. But the
 current version of pgadmin does not contain it (or I could not find
 it).  Is there any actual tool for this purpose ?

You can use DBI-Link http://pgfoundry.org/projects/dbi-link/ to make
the MS-SQL Server data available to PostgreSQL and pull it in at your
leisure :)

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 415 235 3778AIM: dfetter666
  Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

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

   http://archives.postgresql.org/


Re: [GENERAL] Migrate postgres DB to oracle

2007-04-05 Thread Vladimir Zelinski
You can try metalink (https://metalink.oracle.com/),
but they want $$$ for forum like this one.


--- [EMAIL PROTECTED] wrote:

 - Mensaje original -
 De: bcochofel [EMAIL PROTECTED]
 Fecha: Jueves, Abril 5, 2007 7:46 pm
 Asunto: [GENERAL] Migrate postgres DB to oracle
 
  I need some help to migrate a postgres DB (v7.4)
 to oracle.
  His there any tools, SW, scripts or something to
 help me with the job?
  
  Thanks,
  Bruno
  
  
 You're asking in the wrong place (not because nobody
 can help, because it's not polite, you should search
 oracle's forums).
 Anyway, see if someone over here

(http://www.oracle.com/technology/tech/migration/mti/index.html)
 can help you out.
 
 
 
 
 ---(end of
 broadcast)---
 TIP 5: don't forget to increase your free space map
 settings
 


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

   http://archives.postgresql.org/