[GENERAL] HELP - compiling C functions for wiondws

2012-01-31 Thread Edwin Quijada

Hi!
I am trying to compile a C function for windows using VS 2008 Express and I 
getting this errors

pg2.cc:\program files\postgresql\9.0\include\server\pg_config_os.h(203) : error 
C2011: 'timezone' : 'struct' type redefinitionc:\program 
files\postgresql\9.0\include\server\pg_config_os.h(203) : see  declaration of 
'timezone'   c:\program 
files\postgresql\9.0\include\server\pg_config_os.h(212) : error C2011 : 
'itimerval' : 'struct' type redefinitionc:\program 
files\postgresql\9.0\include\server\pg_config_os.h(212) : see  declaration of 
'itimerval' c:\program 
files\postgresql\9.0\include\server\utils/elog.h(118) : error C2365: 'errcode' 
: redefinition; previous definition was 'typedef'C:\Program 
Files\Microsoft Visual Studio 9.0\VC\INCLUDE\crtdefs.h(560) :  see declaration 
of 'errcode'
The command that I used to compile is thiscl /I \Program 
Files\postgreSQL\9.0\include /I \Program Files\postgreSQL\9.0\include\server 
/I \Program Files\postgreSQL\9.0\include\server\port\win32 /c 
D:\exte_c\pg2.c
Any cluees ort any ideas ?I am using PG 9.0.6

*---* 
*-Edwin Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*---*

  

Re: [GENERAL] Compiling C function with VC++ for Windows version

2012-01-13 Thread Edwin Quijada

 

 Date: Fri, 13 Jan 2012 14:44:24 +0800
 From: ring...@ringerc.id.au
 To: listas_quij...@hotmail.com; pgsql-general@postgresql.org
 Subject: Re: [GENERAL] Compiling C function with VC++ for Windows version
 
 On 13/01/2012 1:55 AM, Edwin Quijada wrote:
 
  Ok.
  This is the way that I compile.
  Linux this way works fine and I use the modules compiled. of course, 
  Linux I compile from source and I use gcc.
 
 Yep... but Windows isn't Linux.
 
 In particular, the distributions of PostgreSQL for Windows are compiled 
 using Microsoft Visual C++, not gcc. It is possible to use gcc (mingw) 
 to compile shared libraries that are compatible with programs compiled 
 with MSVC++ but I've generally found it simpler to just use MSVC++ to 
 compile libraries on Windows.
 
 If you prefer to use mingw there's still usually no problem with that, 
 you'll just have to figure out why your function is crashing the server. 
 Things to try:
 
 - Delete code until it stops crashing; or
 - Get a backtrace of the server to see where it crashes and why.
 
 See how I'm repeating get a backtrace of the crash? Check out the link 
 I sent in my last post for info on how to do it using windbg or vc++ 
 express.
 
I am reading the backtrace to Postgres. What is the way to compile using VC++?
I mean what parameters I need to compile?

 --
 Craig Ringer
 
 -- 
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general
  

Re: [GENERAL] Compiling C function with VC++ for Windows version

2012-01-12 Thread Edwin Quijada




Date: Thu, 12 Jan 2012 13:45:06 +0800
From: ring...@ringerc.id.au
To: listas_quij...@hotmail.com
CC: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Compiling C function with VC++ for Windows version


  



  
  
On 12/01/12 11:06, Edwin Quijada wrote:

  
  
Hi!
I am trying to create a C function for windows in Postgres
  compiling with VC++ 2008 Express Edition. I did this function
  for Linux without problem using gcc and tried to do the same
  in Windows but in Windows was imposible. The function compile
  fine but when I tried to run from Postgres it down the server
  in windows but in Linux the same function run perfect.
  



You haven't provided enough information for anyone to help you.



How are you compiling your function? Using pgxs, or some other way?



What's the full source code of the function?



Where does the server crash when it crashes? You might need to get a
backtrace of the server crash to help you figure out why your
function crashes it. See this documentation on getting a backtrace
of a Pg backend under windows:





http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows




  



The function just try to get a string value and pass to
  postgres. Reading somebody told me that I need to compile the
  function using VC++ not gcc in Windows so I downloaded VC++
  2008 Express but I dont know what directives compilation I
  need as gcc in windows and Linux.
  



If you are using a standard binary distribution of PostgreSQL then
yes, you should use Visual C++, preferably the same version of
Visual C++ that was used for that version of PostgreSQL. Specify
your version of Pg.---
Ok.This is the way that I compile. Linux this way works fine and I use the 
modules compiled. of course, Linux I compile from source and I use gcc.
C:\mingw\bin\gcc -g -O2 -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv  -I 
C:/Program Files/PostgreSQL/8.3/include/ -I C:/Program 
Files/PostgreSQL/8.3/include/server -I C:/Program 
Files/PostgreSQL/8.3/include/server/port/win32 -DEXEC_BACKEND -I C:/Program 
Files/PostgreSQL/8.3/include/server/port/win32-c pg2.c -o 
pg2.oC:\mingw\bin\gcc  -shared -o pg_server_function.dll pg2.o -L C:\Program 
Files\PostgreSQL\8.3\lib -lpostgres
It is using gcc in windows version
This is the module that I want to compile
code #include postgres.h#include fmgr.h#include stdio.h#include 
string.h
#include libstd.h
#ifdef PG_MODULE_MAGICPG_MODULE_MAGIC;#endif

PG_FUNCTION_INFO_V1(pg_server_id);
Datum pg_server_id(PG_FUNCTION_ARGS){   char mac[30];   text *new_t = (text *) 
palloc(30);   int32 arg = PG_GETARG_INT32(0);//  getmacwindows(mac);//  
SET_VARSIZE(new_t, strlen(mac) + VARHDRSZ);  memcpy(VARDATA(new_t),(text 
*)mac,strlen(mac));PG_RETURN_TEXT_P(new_t);}
 
PG_FUNCTION_INFO_V1(pg_serverid);Datumpg_serverid(PG_FUNCTION_ARGS){  float8 
mac;  int32   arg = PG_GETARG_INT32(0);  //  arg++;   mac = 
getmacwindows2num();  //  PG_RETURN_FLOAT8(mac);}   


PG_FUNCTION_INFO_V1(one);   Datum one(PG_FUNCTION_ARGS) {   
int32   arg = PG_GETARG_INT32(0);   int32 x= ++arg; 
//mac2num(); //getmacwindows(mac);  PG_RETURN_INT32(x); }/code
The function is simple just get the mac address of the PC. Now, I am trying to 
use VC++ 2008 Express to compile this module but I dont know how to pass all 
these parameters using VC++
In this example is 8.3 but I tried with 9.0 too
This compile fine the problem at running timme this crash down my server..:(Any 
help will be so apreciated.



--

Craig Ringer
  

[GENERAL] Compiling C function with VC++ for Windows version

2012-01-11 Thread Edwin Quijada

Hi!I am trying to create a C function for windows in Postgres compiling with 
VC++ 2008 Express Edition. I did this function for Linux without problem using 
gcc and tried to do the same in Windows but in Windows was imposible. The 
function compile fine but when I tried to run from Postgres it down the server 
in windows but in Linux the same function run perfect.
The function just try to get a string value and pass to postgres. Reading 
somebody told me that I need to compile the function using VC++ not gcc in 
Windows so I downloaded VC++ 2008 Express but I dont know what directives 
compilation I need as gcc in windows and Linux.
Somebody here has compiled any function for working in Windows for Postgres 
using VC++?
Any help will be so appreciated. 
*---* 
*-Edwin Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*---*

  

[GENERAL] Compiling with MinGW in windows , compile but my server down

2010-09-08 Thread Edwin Quijada

Hi!!
I could compile my windows extension for Postgres but now when I try to run 
this extension my server goes down. I compiled using Mingw and this line

C:\mingw\bin\gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv 
  -I C:/Program 
Files/PostgreSQL/8.3/include/ 
  -I C:/Program 
Files/PostgreSQL/8.3/include/server 
  -I C:/Program 
Files/PostgreSQL/8.3/include/server/port/win32 
  -DEXEC_BACKEND -I C:/Program 
Files/PostgreSQL/8.3/include/server/port/win32-c pg2.c -o pg2.o
AND for linking

C:\mingw\bin\gcc  -shared -o pg_server_function.dll pg2.o -L C:\Program 
Files\PostgreSQL\8.3\lib -lpostgres

This compile without errors but when I created the function and try to run I 
get my server down.
There is any way to debug this function to find out what cause the error ??

TIA


*---* 
*-Edwin Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*---*



  

Re: [GENERAL] Compiling extension C with MingW in windows, Error...

2010-09-03 Thread Edwin Quijada






 Date: Fri, 3 Sep 2010 09:41:17 +0200
 Subject: Re: [GENERAL] Compiling extension C with MingW in windows, Error...
 From: mag...@hagander.net
 To: listas_quij...@hotmail.com
 CC: pgsql-general@postgresql.org
 
 On Fri, Sep 3, 2010 at 5:31 AM, Edwin Quijada
 listas_quij...@hotmail.com wrote:
  Hi, I am tryng to compile a C extension in windows using Minigw but always I
  get the same error
 
  C:\Program Files\PostgreSQL\8.3\share\exte_cC:\mingw\bin\gcc -shared -o
  pg2.dll
   pg2.o
  pg2.o:pg2.c:(.text+0x86): undefined reference to
  `_imp__CurrentMemoryContext'
  pg2.o:pg2.c:(.text+0x92): undefined reference to `MemoryContextAlloc'
  collect2: ld returned 1 exit status
 
  This error is just when it links.
 
 You need to link against postgres.exe to get access to these symbols.
 I don't recall if the mingw linker allows you to just specify the EXE
 file these days, but I think it does. If not, you'll need to create an
 import library from the EXE and link to that (the binary distribution
 only ships with import libraries for MSVC, but mingw can't use
 standard windows import libraries, so you need to create your own
 there)

Magnus how can I linking against postgres.exe I mean the gcc line. I did others 
function and worked fine 

This is the function that I did and worked, with this code I did a foo.dll and 
added this to postgresql.

#include postgres.h
#include string.h
#include fmgr.h

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

/* by value */

PG_FUNCTION_INFO_V1(add_one);

Datum add_one(PG_FUNCTION_ARGS)
{
int32   arg = PG_GETARG_INT32(0);

PG_RETURN_INT32(arg + 1);
}




*---* 
*-Edwin
 Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*---*


  

[GENERAL] Compiling extension C with MingW in windows, Error...

2010-09-02 Thread Edwin Quijada

Hi, I am tryng to compile a C extension in windows using Minigw but always I 
get the same error

C:\Program Files\PostgreSQL\8.3\share\exte_cC:\mingw\bin\gcc -shared -o pg2.dll
 pg2.o
pg2.o:pg2.c:(.text+0x86): undefined reference to `_imp__CurrentMemoryContext'
pg2.o:pg2.c:(.text+0x92): undefined reference to `MemoryContextAlloc'
collect2: ld returned 1 exit status

This error is just when it links.

Aparently this occur just when use text vardata

This is the code for my function. This function was taken from manual page but 
it doesnt work neither.

#include string.h
#include fmgr.h

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif


PG_FUNCTION_INFO_V1(concat_text);

Datum
concat_text(PG_FUNCTION_ARGS)
{
text  *arg1 = PG_GETARG_TEXT_P(0);
text  *arg2 = PG_GETARG_TEXT_P(1);
int32 new_text_size = VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ;

text *new_text = (text *) palloc(new_text_size);

VARATT_SIZEP(new_text) = new_text_size;
   //
memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ);
memcpy(VARDATA(new_text) + (VARSIZE(arg1)-VARHDRSZ),
   // 
   VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ);
PG_RETURN_TEXT_P(new_text);
}

Any clues about this ???

*---* 
*-Edwin Quijada 
*-Developer DataBase 
*-JQ Microsistemas 

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*---*



  

Re: [GENERAL] [pgsql-es-ayuda] transportar base de datos

2005-07-22 Thread Edwin Quijada
La forma facil y rapido crea , un link a ese directorio y muevelo a otro 
directorio


*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun

*---*




From: diego ayala torres [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Subject: [pgsql-es-ayuda] transportar base de datos
Date: Fri, 22 Jul 2005 14:34:11 -0400


buenas tardes, me gustaria hacerles una consulta acerca de un problema q
tengo, la situacion es q la persona q instalo linux en el servidor, pero,
particiono el disco de una forma asigo poco espacio al directorio /var, y 
ya

esta por el 55% utilizado, en este directorio reside mi base de datos
postgres, necesito saber si puedo, y como podria trasladar mi base de
datos a otro directorio..

Gracias por su atencion, Saludos..

-


Este verano... ¿Quieres ligar? No lo dudes y ven a Citaciega. 
http://citaciega.ya.com
Ya.com ADSL 2MB + Llamadas 24 horas: desde 26,95 €/mes + IVA. Navega y 
habla de forma ilimitada. Sin compromiso de permanencia. 
http://acceso.ya.com/ADSLllamadas/2mb


---(fin del mensaje)---
TIP 7: no olvides aumentar la configuración del free space map


_
¿Cuánto vale tu auto? Tips para mantener tu carro. ¡De todo en MSN Latino 
Autos! http://latino.msn.com/autos/



---(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] Big string using Zeos from Delphi

2004-04-08 Thread Edwin Quijada
Hi!!
I am trying to store a picture into pg database.  I am usig delphi and 
ZeosDBO. I convert the picture into base64 text to send to database but when 
I do this I get this error trying to do insert :

SQL:Error pqreadData()
Read()--failed: errno=0
No error
I test using Pgexplorer, this use libpq too, and everything is fine doing 
insert and loading from select.
When I try to do a load with select I get the same error above.
At the first I was thinking , the problem was the escape character / but 
when I do it the same for pgadmin this ran fine. I replace the character / 
for * too, for testing and nothing happens I got the same error.

Somebody has idea?
I know maybe it doesnt appear here but is just help! :(


*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.latam.msn.com/

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


Re: [GENERAL] Service doesnt UP!!!!

2003-11-07 Thread Edwin Quijada
Hi!!!
This is my log after break down::
There is a app to fix the database.
The server must be started under an unprivileged user id to prevent
a possible system security compromise.  See the documentation for
more information on how to properly start the server.
LOG:  database system was interrupted at 2003-11-07 10:54:32 CET
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1327) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:33:19 CET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1354) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:35:34 CET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1090) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:40:47 CET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1196) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:46:13 CET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1531) was terminated by signal 6
LOG:  aborting startup due to startup process failure



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Richard Huxton [EMAIL PROTECTED]
To: Edwin Quijada 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: [GENERAL] Service doesnt UP
Date: Fri, 7 Nov 2003 17:05:48 +

On Friday 07 November 2003 16:19, Edwin Quijada wrote:
 Hi!!!
 I had a break electrical service and my system go down. Now when I try 
to
 up the postgres service I get this error:

 psql: could not connect to server: No such file or directory
 Is the server running locally and accepting
 connections on Unix domain socket /tmp/.s.PGSQL.5432?
 createdb: database creation failed

This is showing psql not connecting - you want to see what happens when you
start the backend.
 I went to directory data and delete postmaster.pid and postmaster.opts 
but
 nothing happens.
 I have the same error.
 PLease I need urgent help!!!

Where are your logs? There should be something there. If not, start 
postgres
in the manner described in the installation instructions - that should show
you where the problem is.

--
  Richard Huxton
  Archonet Ltd
_
MSN Messenger with backgrounds, emoticons and more. 
http://www.msnmessenger-download.com/tracking/cdp_customize

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

Re: [GENERAL] Recovery Data Cant Be!!!

2003-11-07 Thread Edwin Quijada
Where set zero_damaged_pages ??



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Jeff [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Recovery Data Cant Be!!!
Date: Fri, 7 Nov 2003 13:25:18 -0500
On Fri, 07 Nov 2003 18:08:32 +
Edwin Quijada [EMAIL PROTECTED] wrote:
 LOG:  redo starts at 1/34600358
 PANIC:  Invalid page header in block 8805 of 17097
Hmm.. Does this machine bychance run with fsync=false or an IDE drive?

You may be able to salvage things if you turn zero_damaged_pages on in
postgresql.conf..
but in general it seems your db is corrupt.

You might want to make a copy of $PGDATA before you try the
zero_damaged_pages thingy.


--
Jeff Trout [EMAIL PROTECTED]
http://www.jefftrout.com/
http://www.stuarthamm.net/
_
Las mejores tiendas, los precios mas bajos, entregas en todo el mundo, 
YupiMSN Compras: www.yupimsn.com/compras

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


Re: [GENERAL] Power Electrical Down!!!!!

2003-11-07 Thread Edwin Quijada
I am trying running up  using
pg_ctl -D /data/dir -l logfile
This is the last 100 lines from log

The server must be started under an unprivileged user id to prevent
a possible system security compromise.  See the documentation for
more information on how to properly start the server.
LOG:  database system was interrupted at 2003-11-07 10:54:32 CET
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1327) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:33:19 C
ET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1354) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:35:34 CET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1090) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:40:47 C
ET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1196) was terminated by signal 6
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted being in recovery at 2003-11-07 
23:46:13 C
ET
   This probably means that some data blocks are corrupted
   and you will have to use the last backup for recovery.
LOG:  checkpoint record is at 1/34600318
LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown FALSE
LOG:  next transaction id: 6326695; next oid: 5776573
LOG:  database system was not properly shut down; automatic recovery in 
progress
LOG:  redo starts at 1/34600358
PANIC:  Invalid page header in block 8805 of 17097
LOG:  startup process (pid 1531) was terminated by signal 6
LOG:  aborting startup due to startup process failure



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: MaRcElO PeReIrA [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
Subject: Re: [GENERAL] Power Electrical Down!
Date: Fri, 7 Nov 2003 16:03:26 -0300 (ART)
Hi there,

First of all, you have not lost your data!! Unless in
case of hardware corruption!
Well, run the postgres with the -l flag and take a
look at the error:
$ pg_ctl -D /data/dir -l logfile

Let us see what is going on the logfile!!

Regards,

MaRcElO PeReirA
PHP/SQL/PostgreSQL
 --- Edwin Quijada [EMAIL PROTECTED]
escreveu:  Hi!!!
 I had a break electrical service and my system go
 down. Now when I try to up
 the postgres service I get this error:

 psql: could not connect to server: No such file or
 directory
Is the server running locally and accepting
connections on Unix domain socket
 /tmp/.s.PGSQL.5432?
 createdb: database creation failed

 I went to directory data and delete postmaster.pid
 and postmaster.opts but
 nothing happens.
 I have the same error.
 PLease I need urgent help!!!

 I lost my data??
 What can I do to back service up with my data??







*---*
 *-Edwin Quijada
 *-Developer DataBase
 *-JQ Microsistemas
 *-809-747-2787
 *  Si deseas lograr cosas excepcionales debes de
 hacer cosas fuera de lo
 comun

Re: [GENERAL] Recovery Data Cant Be!!!

2003-11-07 Thread Edwin Quijada
This is the way to do that?

./pgfsck -D /usr/local/pgsql/data -da union_seguros  
/var/lib/pgsql/bak_union

What is the correct setting to never do that?
What is a solid storage subsystem?
fsync=false ?
write cache enabled?
Can you explain me this?
Postgres
I use IDE disk
*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: scott.marlowe [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Recovery Data Cant Be!!!
Date: Fri, 7 Nov 2003 13:29:57 -0700 (MST)
You're likely looking for pgfsck:

http://svana.org/kleptog/pgsql/pgfsck.html

Strong medicine, please backup your $PGDATA directory before playing
there, as you might wind up breaking things.
What's the exact error message in your logs when the database won't start
up?
The problem you're seeing is common when running on IDE drives with write
cache enabled, or with fsync=false on IDE with write cache disabled or
SCSI.  On a solid storage subsystem, postgresql is close to
indestrubtable, i.e. you can crank up 500 simo transactions, pull the
plug, and the database will come right back up.  That's how we test our
servers to make sure that the WAL and such is working properly.
On Fri, 7 Nov 2003, Edwin Quijada wrote:

 Hi!!
 There is an app to recover data for postgres after inapropiate server
 shutdown or power electrical down?
 I have a great problem. My system go down inapropiate and now my server
 doesnt up.
 What 's up with my data?
 I lost my data?
 I dont believe that a robust database like postgres is so weak for power
 down and understand that can go down electrical power but fail 2 ups.

 If somebody has any idea to help me this is the log file

 The server must be started under an unprivileged user id to prevent
 a possible system security compromise.  See the documentation for
 more information on how to properly start the server.

 LOG:  database system was interrupted at 2003-11-07 10:54:32 CET
 LOG:  checkpoint record is at 1/34600318
 LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown 
FALSE
 LOG:  next transaction id: 6326695; next oid: 5776573
 LOG:  database system was not properly shut down; automatic recovery in
 progress
 LOG:  redo starts at 1/34600358
 PANIC:  Invalid page header in block 8805 of 17097
 LOG:  startup process (pid 1327) was terminated by signal 6
 LOG:  aborting startup due to startup process failure
 LOG:  database system was interrupted being in recovery at 2003-11-07
 23:33:19 CET
 This probably means that some data blocks are corrupted
 and you will have to use the last backup for recovery.
 LOG:  checkpoint record is at 1/34600318
 LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown 
FALSE
 LOG:  next transaction id: 6326695; next oid: 5776573
 LOG:  database system was not properly shut down; automatic recovery in
 progress
 LOG:  redo starts at 1/34600358
 PANIC:  Invalid page header in block 8805 of 17097
 LOG:  startup process (pid 1354) was terminated by signal 6
 LOG:  aborting startup due to startup process failure
 LOG:  database system was interrupted being in recovery at 2003-11-07
 23:35:34 CET
 This probably means that some data blocks are corrupted
 and you will have to use the last backup for recovery.
 LOG:  checkpoint record is at 1/34600318
 LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown 
FALSE
 LOG:  next transaction id: 6326695; next oid: 5776573
 LOG:  database system was not properly shut down; automatic recovery in
 progress
 LOG:  redo starts at 1/34600358
 PANIC:  Invalid page header in block 8805 of 17097
 LOG:  startup process (pid 1090) was terminated by signal 6
 LOG:  aborting startup due to startup process failure
 LOG:  database system was interrupted being in recovery at 2003-11-07
 23:40:47 CET
 This probably means that some data blocks are corrupted
 and you will have to use the last backup for recovery.
 LOG:  checkpoint record is at 1/34600318
 LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown 
FALSE
 LOG:  next transaction id: 6326695; next oid: 5776573
 LOG:  database system was not properly shut down; automatic recovery in
 progress
 LOG:  redo starts at 1/34600358
 PANIC:  Invalid page header in block 8805 of 17097
 LOG:  startup process (pid 1196) was terminated by signal 6
 LOG:  aborting startup due to startup process failure
 LOG:  database system was interrupted being in recovery at 2003-11-07
 23:46:13 CET
 This probably means that some data blocks are corrupted
 and you will have to use the last backup for recovery.
 LOG:  checkpoint record is at 1/34600318
 LOG:  redo record is at 1/34600318; undo record is at 0/0; shutdown 
FALSE
 LOG:  next transaction id: 6326695

Re: [GENERAL] Recovery Data Cant Be!!!

2003-11-07 Thread Edwin Quijada
Sure you can, and in fact that's the only place that will work for
Edwin's problem.  He hasn't *got* a psql session, because postmaster
startup is failing
Please, How can I do that



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Tom Lane [EMAIL PROTECTED]
To: Bruce Momjian [EMAIL PROTECTED]
CC: Edwin Quijada [EMAIL PROTECTED], [EMAIL PROTECTED],   
[EMAIL PROTECTED]
Subject: Re: [GENERAL] Recovery Data Cant Be!!! Date: Fri, 07 Nov 2003 
16:29:18 -0500

Bruce Momjian [EMAIL PROTECTED] writes:
 Edwin Quijada wrote:
 Where set zero_damaged_pages ??
 You can't set it from postgresql.conf.

Sure you can, and in fact that's the only place that will work for
Edwin's problem.  He hasn't *got* a psql session, because postmaster
startup is failing.
			regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
_
Compare high-speed Internet plans, starting at $26.95.  
https://broadband.msn.com (Prices may vary by service area.)

---(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] Recovery Data Cant Be!!!

2003-11-07 Thread Edwin Quijada
OKi
how can I do that from postgresql.conf?


*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Tom Lane [EMAIL PROTECTED]
To: Bruce Momjian [EMAIL PROTECTED]
CC: Edwin Quijada [EMAIL PROTECTED], [EMAIL PROTECTED], 
   [EMAIL PROTECTED]
Subject: Re: [GENERAL] Recovery Data Cant Be!!! Date: Fri, 07 Nov 2003 
16:29:18 -0500

Bruce Momjian [EMAIL PROTECTED] writes:
 Edwin Quijada wrote:
 Where set zero_damaged_pages ??
 You can't set it from postgresql.conf.

Sure you can, and in fact that's the only place that will work for
Edwin's problem.  He hasn't *got* a psql session, because postmaster
startup is failing.
			regards, tom lane
_
Send a QuickGreet with MSN Messenger 
http://www.msnmessenger-download.com/tracking/cdp_games

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [GENERAL] Recovery Data Cant Be!!!

2003-11-07 Thread Edwin Quijada
How can I do from postgresql.conf?


From: Bruce Momjian [EMAIL PROTECTED]
To: Tom Lane [EMAIL PROTECTED]
CC: Edwin Quijada [EMAIL PROTECTED],[EMAIL PROTECTED], 
[EMAIL PROTECTED]
Subject: Re: [GENERAL] Recovery Data Cant Be!!!
Date: Fri, 7 Nov 2003 16:31:43 -0500 (EST)

Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  Edwin Quijada wrote:
  Where set zero_damaged_pages ??

  You can't set it from postgresql.conf.

 Sure you can, and in fact that's the only place that will work for
 Edwin's problem.  He hasn't *got* a psql session, because postmaster
 startup is failing.
Oh, I never realized it would work with damage that severe.

--
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 
19073

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
_
Las mejores tiendas, los precios mas bajos, entregas en todo el mundo, 
YupiMSN Compras: www.yupimsn.com/compras

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


[GENERAL] Problem with Pg_dumpall

2003-11-04 Thread Edwin Quijada
Hi!
I am trying to do a dump all and when I do this I get this error
pg_dumpall: query failed: ERROR:  Unable to convert abstime 'invalid' to 
timestamp
pg_dumpall: query was: SELECT usename, usesysid, passwd, usecreatedb, 
usesuper, CAST(valuntil AS timestamp) FROM pg_shadow WHERE usesysid  
(SELECT datdba FROM pg_database WHERE datname = 'template0');

What is my problem???

_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/

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


[GENERAL] Error size varchar

2003-10-29 Thread Edwin Quijada




Hi!!
I got error about a length field varchar. I have a table with a field type 
varchar(20) but if I try to set to this field more than 20 characters I got 
error.
I did a function to control the length of data and put it on trigger but 
when it ocurrs I got the error anyway and the trigger not works.
This error is over than trigger execution??

This is the error

ERROR:  value too long for type character varying(30)

*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
Surf and talk on the phone at the same time with broadband Internet access. 
Get high-speed for as low as $29.95/month (depending on the local service 
providers in your area).  https://broadband.msn.com

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


[GENERAL] backup another server

2003-10-29 Thread Edwin Quijada


Hi!!
I wanna take a whole database running in a box1 pg7.3.4 and moving to 
another box2 with 7.3.4 too.
There is a fast way to do that??
Which??/



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
Fretting that your Hotmail account may expire because you forgot to sign in 
enough? Get Hotmail Extra Storage today!   
http://join.msn.com/?PAGE=features/es

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


[GENERAL] Trigger delete

2003-10-29 Thread Edwin Quijada
What is that I have to return in a delete trigger??
return OLD or NEW
_
Add MSN 8 Internet Software to your current Internet access and enjoy 
patented spam control and more.  Get two months FREE! 
http://join.msn.com/?page=dept/byoa

---(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] Error size varchar

2003-10-29 Thread Edwin Quijada
wHAT IS unconstrained varchar???



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*





From: Tom Lane [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Error size varchar Date: Wed, 29 Oct 2003 11:28:23 
-0500

Edwin Quijada [EMAIL PROTECTED] writes:
 I got error about a length field varchar. I have a table with a field 
type
 varchar(20) but if I try to set to this field more than 20 characters I 
got
 error.
 I did a function to control the length of data and put it on trigger but
 when it ocurrs I got the error anyway and the trigger not works.

The length constraint is checked before triggers are fired, I believe.
If you want silent truncation rather than an error, use a text column
(or unconstrained varchar) and put the truncation behavior into your
trigger.
			regards, tom lane
_
Fretting that your Hotmail account may expire because you forgot to sign in 
enough? Get Hotmail Extra Storage today!   
http://join.msn.com/?PAGE=features/es

---(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] is possible to read oracle tables from PostgresSQL

2003-10-16 Thread Edwin Quijada
Wel, If you use Plperl I supposed or perl!!

From: Marco [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [GENERAL] is possible to read oracle tables from PostgresSQL
Date: Wed, 15 Oct 2003 19:10:42 GMT
I need to know if is possible to read oracle tables from PostgresSQL (and
vice versa).
Can someone give me some help?


Thanks a lot



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
_
¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/
---(end of broadcast)---
TIP 8: explain analyze is your friend


[GENERAL] I dont know the error with updtae

2003-09-18 Thread Edwin Quijada
Hi!
I have a trigger using a update but this doestn work into trigger but if I 
execute the update from pgadmin this works perfectely.

This is the code
select into registro * from t_pagos_comisiones where f_wholetipoagnivel = 
who and f_fecha = $4 for update;
IF FOUND THEN
 IF ($5 0) THEN
 t1:= registro.f_montopagado+$7;
 t2:= registro.f_montocomision+$5;
 raise notice ''  hacer el update t1 y t2 %, %'',t1,t2; 
--f_montocomision=t2
 UPDATE t_pagos_comisiones SET 
f_montopagado=t1,f_montocomision=t2,f_nivel=90  wheref_wholetipoagnivel 
= who and f_fecha = vfecha;
end if;
end if;

*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[GENERAL] Picture with Postgres and Delphi

2003-09-09 Thread Edwin Quijada
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 50 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

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


[GENERAL] Panic Index!!!!

2003-09-05 Thread Edwin Quijada
Hi this is my code of sql select

SELECT
a.f_codigo_cliente,
a.f_fecha_inicio_vigencia,
a.f_fecha_fin_vigencia,
b.f_nombre,
b.f_apellido,
e.f_chassis,
e.f_placa,
e.f_registro,
e.f_color,
e.f_year,
g.f_descripcion_marca,
f.f_descripcion_modelo
FROM
t_poliza_vehiculos a,
t_clientes b,
t_vehiculos_asegurados d,
t_vehiculos e,
t_agentes c,
t_marcas_vehiculos g,
t_modelos f
WHERE
a.f_codigo_cliente = b.f_codigo_cliente AND
a.f_agente = c.f_codigo_agente AND
a.f_wholenum = d.f_wholenum AND
d.f_idvehiculo = e.f_keyvehiculo AND
e.f_modelo = f.f_idmodelo AND
f.f_idmarca = g.f_codigo_marca AND
a.f_wholenum = 'POL01';
This select get 20 seconds to doing. My 2 first table has 50 reords each 
one

Explain   
Merge Join  (cost=79.44..7127.72 rows=226 width=347)
 Merge Cond: (outer.f_wholenum = inner.f_wholenum)
 -  Nested Loop  (cost=0.00..7025.77 rows=1807 width=116)
   -  Nested Loop  (cost=0.00..17.13 rows=1 width=44)
 Join Filter: (outer.f_agente = inner.f_codigo_agente)
 -  Index Scan using t_poliza_vehiculos_f_wholenum_idx on 
t_poliza_vehiculos a  (cost=0.00..17.07 rows=5 width=40)
   Index Cond: (f_wholenum = 'POL01'::bpchar)
 -  Seq Scan on t_agentes c  (cost=0.00..0.00 rows=1 width=4)
   -  Index Scan using f_id on t_clientes b  (cost=0.00..6986.05 
rows=1807 width=72)
 Index Cond: (outer.f_codigo_cliente = b.f_codigo_cliente)
 -  Sort  (cost=79.44..79.76 rows=125 width=231)
   Sort Key: d.f_wholenum
   -  Hash Join  (cost=43.53..75.09 rows=125 width=231)
 Hash Cond: (outer.f_codigo_marca = inner.f_idmarca)
 -  Seq Scan on t_marcas_vehiculos g  (cost=0.00..20.00 
rows=1000 width=43)
 -  Hash  (cost=43.47..43.47 rows=25 width=188)
   -  Hash Join  (cost=18.15..43.47 rows=25 width=188)
 Hash Cond: (outer.f_idvehiculo = 
inner.f_keyvehiculo)
 -  Seq Scan on t_vehiculos_asegurados d  
(cost=0.00..20.00 rows=1000 width=28)
 -  Hash  (cost=18.14..18.14 rows=5 width=160)
   -  Nested Loop  (cost=0.00..18.14 rows=5 
width=160)
 -  Seq Scan on t_vehiculos e  
(cost=0.00..1.01 rows=1 width=113)
 -  Index Scan using 
t_modelos_f_idmodelo_idx on t_modelos f  (cost=0.00..17.07 rows=5 width=47)
   Index Cond: (outer.f_modelo = 
f.f_idmodelo)
/



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
Las mejores tiendas, los precios mas bajos, entregas en todo el mundo, 
YupiMSN Compras: www.yupimsn.com/compras

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


[GENERAL] Activate Index

2003-09-04 Thread Edwin Quijada
Hi!!
This is my first post to the list. I have a problem.
I have a table with a two index , int4, but when I do a search using the 
field indexed but when I applied an explain to the query it says Seq Scan , 
I mean , that it doesnot use the index.
I cant use the cast field::int4 because I use delphi and delphi does not 
support this.
I know there is a command to activate index aand always postgrres will be 
the index
Which are this command???
Anyone knows?

*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


[GENERAL] IP from conexion

2003-09-04 Thread Edwin Quijada
Hi [EMAIL PROTECTED]
There is a something way to know which are the IP from conexcion to Postgres 
since plPgsql
something like CURRENT_IP



*---*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-747-2787
*  Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo 
comun
*---*

_
¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/
---(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] Activate Index

2003-09-04 Thread Edwin Quijada
ok!
U can tell me about the best setup and performance?
and best parameters to setup I am so newbie  ?
I am using Postgres to emigrate a system in 4D Server to PgSql With Delphi 
for insurance company.
My server is Pentium IV 2.0 Ghz , 1 GB Ram, 40 GB HD 7200RPM?
Now I wanna know what is the best setup



From: scott.marlowe [EMAIL PROTECTED]
To: Edwin Quijada [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [GENERAL] Activate Index
Date: Thu, 4 Sep 2003 08:58:57 -0600 (MDT)
What query are you running?

If you run

select * from indexed_table

you'll get a seq scan because you're hitting every row.

If you're doing

select * from indexed_table where indexed_field=1

you should get an index scan.

Anything in between the query planner will decide.  Unlike some older
databases that used a rules based planner, postgresql uses a cost based
planner.  I.e. it figures out which costs more, a seq scan or an index
scan, and chooses accordingly.
In order to do this properly, it needs to know how your data is laid out.
Have you run analyze on your database?
If the query planner still makes the wrong you can force things with set
enable_seqscan = off temporarily to see if postgresql really is making
the best choice.  Then run your query with explain analyze  at the front
and postgresql will run the query, report back how it ran it, how much it
THOUGHT it would cost, and how long it really took.
Then, you can tune your database by messing about with random_page_cost,
cpu*cost (3 different vars) effective_cache_size, shared_buffers, and
sort_mem.
Postgresql is like a large complex piece of machinery that runs great once
it's been setup, but suffers from pretty mediocre performance in it's
default installation format due to the need to start on some pretty
ancient operating systems / hardware setups.  Lately, some of those
defaults have been increased a bit, but they're still small for a
workgroup or enterprise class database.
On Thu, 4 Sep 2003, Edwin Quijada wrote:


 Well , My table has 38 records!!!


 From: Mattias Kregert [EMAIL PROTECTED]
 To: Edwin Quijada [EMAIL PROTECTED]
 Subject: Re: [GENERAL] Activate Index
 Date: Thu, 4 Sep 2003 15:58:33 +0200
 
 Hello Edwin,
 
 The index will be used automatically when you have enough rows in the
 table. For tables with a small number of rows, a seq scan will be made
 because it is actually faster than using the index with a small number 
of
 rows.
 
 You also have to remember to run VACUUM from time to time, so that the
 statistics are updated so the planner can see how many rows are in the
 table.
 
 
 /Mattias
 
 - Original Message -
 From: Edwin Quijada [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, September 04, 2003 4:02 PM
 Subject: [GENERAL] Activate Index
 
 
   Hi!!
   This is my first post to the list. I have a problem.
   I have a table with a two index , int4, but when I do a search using 
the
   field indexed but when I applied an explain to the query it says Seq
 Scan ,
   I mean , that it doesnot use the index.
   I cant use the cast field::int4 because I use delphi and delphi does 
not
   support this.
   I know there is a command to activate index aand always postgrres 
will
 be
   the index
   Which are this command???
   Anyone knows?
  
  
   *---*
   *-Edwin Quijada
   *-Developer DataBase
   *-JQ Microsistemas
   *-809-747-2787
   *  Si deseas lograr cosas excepcionales debes de hacer cosas fuera 
de
 lo
   comun
   *---*
  
   _
   ¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/
  
  
   ---(end of 
broadcast)---
   TIP 5: Have you checked our extensive FAQ?
  
  http://www.postgresql.org/docs/faqs/FAQ.html
  

 _
 ¿Estás buscando un auto nuevo?  http://www.yupimsn.com/autos/


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


_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html