  ------------------------------------------------------------------------

Frequently Asked Questions (FAQ) for PostgreSQL >= V6.1

Linux  

Ϲ FAQ Բ о մϴ.
  ------------------------------------------------------------------------
 ģ ¥: 1998 5 11

   : ص C.R. ƾ (martin@biochem.ucl.ac.uk)
츮 ű  :  (honest@hitel.net)

  ------------------------------------------------------------------------

     κ  ֽϴ.

1.) PostgreSQL ġϱ
2.) α׷ ϱ
3.) ÿ ޴ 

 :

1.1) src/Makefile.global ̳ src/Makefile.custom   ľ
մϱ? ޸  ľ   ֳ?
1.2) libreadline  ٴ   ϱ?
1.3) [ ] libdl  dlfcn.h  ٴ   ϱ?
1.4) [ 3.1] libdl  dlfcn.h  ٴ   ϱ?
1.5) 鿣带 ϸ dlfcn.h  Ŭ  ٴ ޽
 ׾ϴ.
1.6) GCC  -fpic ɼ õǾٴ ޽ ϴ.
1.7)    ޽ ޾ҽϴ.

         warning: cast from pointer to integer of different size

1.8) [SuSE-Linux 4.2-4.4] curses  termcap   ֳ?
1.9) ld.so   ϴ. ?
1.10) 'yy_flush_buffer undefined'    ϱ?
1.11) a.out ýۿ  PostgreSQL  ؾ մϱ?
1.12)     ?

        yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
        make: /usr/bin/make: cannot execute binary file

1.13) src/Makefile.global  X11_LIB  ִ libsocket  libnsl 
۷ Դϱ?
1.14) [] libtermcap   ֽϱ?
1.15) [] PostgreSQL  RPM ·   ֳ?
1.16) Linux Ͽ   Ϸٰ   ޽ Բ
Ͽ ߽ϴ

        In file included from /usr/include/sys/sem.h:8, from ipc.c:37:
        /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
        ....
        make: *** [ipc.o] Error 1

1.17) postgres, gcc  ϸ signal 11  ߻ǰ ߴܵ˴ϴ.
1.18) MkLinux  6.1.1  ġ  ֽϱ?
1.19) make  ǰų ״  ?
1.20) 486 ̳ Ƽ ȭŰ  մϱ?

2.1) pgtclsh    Ŀ libX11  ã մϴ.

3.1) createuser  ũƮ Ű    ɴϴ.

          _fUnKy_POSTPORT_sTuFf_ undefined

3.2) postmaster  Ű  'Bad system call(Core dumped) 
޽ ɴϴ.
3.3) postmaster  Ű ϸ    ϴ.

        Failed Assertion("!(file != 0):(null)", File:
        "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
        !(file != 0) (0)
        initdb: could not create template database
        initdb: cleaning up.

3.4) createuser   ۵ ʳ?
3.5)      ̴ϱ?

        IpcMemoryCreate: memKey=155356396 , size=760632 ,
        permission=384IpcMemoryCreate: shmget(..., create, ...)
        failed: Invalid argument

3.6) psql  ̷ ޽ Բ ǰ ϴ

        psql: can't load library 'libpq.so.1'

3.7) Ÿ ̻ 
3.8) PostgreSQL  ǰ ִµ ý ˴ٿ Ű Linux 
õǾ   fsck  ϰ ˴ϴ.
3.9) ȸ ׽Ʈ Query 32   ׷ ð  ɸϱ?
3.10)  date/time 꿡 ݿø ̻ϰ ˴ϴ.
select '4 hours'::timespan;  Ű
'3 hours 59 minutes 60 seconds'   ɴϴ.

  ------------------------------------------------------------------------

1 : PostgreSQL ϱ

  ------------------------------------------------------------------------

1.1) src/Makefile.global ̳ src/Makefile.custom   ľ
մϱ? ޸  ľ   ֳ?

makefile    ġ  src 丮 Ŀ͸
нũƮ Ͽ  ȯ濡 ´ Makefile.custom  
Դϴ.

 ܿ ־  ̶  Flex   2.5.3   
쿡 Flex  ġִ Դϴ. 2.5.3.  createuser 
 մϴ. ( 3.4  )

۾ makefile  ģٸ ݵ    ־ մϴ.

        PORTNAME=       linux

 ȯ溯 ġϴ ȯ濡 °  ־ մϴ.

        POSTGRESDIR

USE_TCL ɼ ѳ´ٸ  鵵 ؾ մϴ.

        TCL_INCDIR=
        TCL_LIBDIR=
        TCL_LIB=
        TK_INCDIR=
        TK_LIBDIR=
        TK_LIB=
        X11_INCDIR=
        X11_LIBDIR=
        X11_LIB=

 3.0  Ѵٸ Ƹ ̷  Դϴ.

        TCL_INCDIR=     /usr/include/tcl
        TCL_LIBDIR=     /usr/lib
        TCL_LIB=        -ltcl
        TK_INCDIR=      /usr/include/tcl
        TK_LIBDIR=      /usr/lib
        TK_LIB=         -ltk
        X11_INCDIR=     /usr/include/X11
        X11_LIBDIR=     /usr/X386/lib
        X11_LIB=        -lX11

INSTALL ϰ Makefile.global  ִ´ ٸ 鵵 ˸° 
־  Դϴ.

1.2) libreadline  ٴ   ϱ?

Linux ýۿ  GNU  readline ̺귯 ó ġǾ 
ʽϴ. src/Makefile.global ̳ src/Makefile.custom Ͽ readline
ɼ Ȱȭ  ʾҴ ȮϽʽÿ. ƴϸ GNU  readline
̺귯 ġϼŵ ˴ϴ.

  FreeBSD   readline ̺귯 ⺻
ġǾ ֽϴ.

1.3) [ ] libdl  dlfcn.h  ٴ   ϱ?

̰  ϴ    dlopen(), dlclose(),  Լ
ũų  ٴ ޽ Ÿϴ.

libdl ̺귯 Ÿӿ  Լ  ũϱ 
˴ϴ.     ̰  ֽϴ. 
4.0 (Colgate)  ϴ.

 翡 ο ld.so RPM Ű ڻ FTP Ʈ
÷ҽϴ.   ϼ.

     ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm

ҿ   RPM  νϽø  OK!

! ̺귯 ġ   ϱ  configure  ٽ
ϰ ó make  ؾ մϴ.

(  ƴմϴٸ) ̺귯 Ʈϰ ִ ߿ α׷
̺귯 ǵ帮 ý   ִٴ  ֽϴ (one report
of corrupted system)  ̺귯 ġϱ  ý Ʈ Ű
׷̵尡 ̷ ִ ߿    α׷ Ű ʴ
 ϴ. ϻ  ۾ ϴ ͵  Դϴ.

   ʹٸ  ҿ ̺귯   
ֽϴ.

     ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz

ٸ δ ̹ ϵǾ ִ ̳ʸ   Ʈ
/distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb  ã 
ֽϴ. ƴϸ  1.2     3.1    ִ
      ֽϴ. Ȯ ڽִ 
ƴ϶    ʴ  ϴ.

1.4) [ 3.1] libdl  dlfcn.h  ٴ   ϱ?

̰  ϴ    dlopen(), dlclose(),  Լ
ũų  ٴ ޽ Ÿϴ.

 1.3   .   3.0   ̺귯 ԵǾ
־,  3.1  ı  ԵǾ  ʱ 3.1 
(1996 9 9  )     CD-ROM  ʱ 3.1
 ۵Ǿϴ. (  ƴմϴٸ) ̺귯 Ʈϰ
ִ ߿ α׷ ̺귯 ǵ帮 ý   ִٴ 
ֽϴ (one report of corrupted system)  ̺귯 ġϱ 
ý Ʈ Ű ׷̵尡 ̷ ִ ߿   
α׷ Ű ʴ  ϴ. ϻ  ۾ ϴ
͵  Դϴ.

    ذϴ  ֱ   a4 ũ
ִ ldso.tgz  ٰ Ʈ(/) 丮 Ǯ,  ɾ
ϴ Դϴ.

        sh install/doinst.sh

ġ ϷϷ  ϼ.

        ldconfig

! ̺귯 ġ   ϱ  configure  ٽ
ϰ ó make  ؾ մϴ.

 ġϰ ʹٸ  dlfcn.h  /usr/include  ġؾ մϴ.

׷ , libdl.so.1.7.14 ( ֱٹ̸ ˴ϴ)  /lib 
ġմϴ. ׸   ϼ.

        cd /lib

        ln -sf libdl.so.1.7.14 libdl.so.1

        ln -sf libdl.so.1 libdl.so

 ýۿ (GCC   ٸϴ)  ۾ ־ մϴ.

        cd /usr/lib

        ln -sf /lib/libdl.so .

  ϼ

        ldconfig

! ̺귯 ġ   ϱ  configure  ٽ
ϰ ó make  ؾ մϴ.

1.5) 鿣带 ϸ dlfcn.h  Ŭ  ٴ ޽
 ׾ϴ.

 1.3/1.4    ϼ. a.out ý ϰ ִٸ
dlfcn.h   dld Ű (밳 a.out ýۿ ⺻ ԵǾ
 ʽϴ) ġؾ մϴ.  1.11  .

1.6) GCC  -fpic ɼ õǾٴ ޽ ϴ.

GCC   -fpic  -fPIC    ޾Ƶ鿴ϴ. ֱ 
(2.7.2?)  -fPIC  䱸ϴ  Դϴ.  ELF 
Ѵٸ -fPIC  ⺻ ǹǷ -fpic  õǾ ϴ.

src/Makefile.global  Ͽ CFLAGS_SL   ٲٸ  ذ 
ֽϴ.

1.7)    ޽ ޾ҽϴ.

        warning: cast from pointer to integer of different size

Postgres95  ʱ ̷ ޽  ص Ǵ
̾ϴ. PostgreSQL 6.0  ý ϵ鿡 õ ͵ (̰
 ص Ǵ Դϴ) ϰ ̷ ޽  ʾƾ մϴ.

1.8) [SuSE-Linux 4.2-4.4] curses  termcap   ֳ?

SuSE-Linux 4.2  curses  ƴ, ncurses   ֽϴ. 4.4  
  ִ  ϴ. SuSE-Linux  termcap ̺귯 /usr/lib 
ƴ϶ /usr/lib/termcap  ֽϴ. PostgreSQL( V6.0 )
---------------------- src/Makefile.custom  CURSES_LIB  -lncurses 
ϼ (Ŀ͸ ũƮ ϸ鼭 ϼŵ ˴ϴ). ׸
src/Makefile.custom    ߰ϼ.

        LDADD_BE+= -L/usr/lib/termcap

src/bin/psql/Make  Ͽ  ׸ ؾ   ֽϴ.

        ifeq ($(PORTNAME), linux)
            LD_ADD+=

̰ Ʒ  ٲټ.

        ifeq ($(PORTNAME), linux)
            LD_ADD+= -ltermcap

PostgreSQL( V6.1 ) ---------------------- (configure) ũƮ
termcap ̺귯 /usr/lib/termcap  ִٴ   մϴ. 
ڴ ߰ ˻ 丮   /usr/lib/termcap  ̺귯
丮   ־ մϴ.   ȿ ٸ (ڿ
SuSE   ˻  ߽ϴ) configure   ,
src/Makefile.global  Ͽ LDFLAGS  ִ  -lreadline ڿ
-ltermcap  ߰ ־ մϴ. (ƴϸ, configure  Ű 
src/Makefile.custom   ־ ˴ϴ) SuSE    ncurses
 ϹǷ curses  ncurses  ϵ  -lcurses 
-lncurses  ٲ־ մϴ. (SuSE 5.1  ׷ٴ  ֽϴ)

1.9) ld.so   ϴ. ?

ELF Ͽ  ε  ʿ ϳ ̺귯 ld.so 
 ٸ, Ƹ ڰ  ġ  (  ɼ
) ׷̵带   Դϴ.  1.3/1.4   .
ld.so.x.y.z  /lib  ġϰ ldconfig  ؾ  ̴ϴ. ld Ű 
 ֱٿ    1.7.14 Դϴ.     1.8.x
   Դϴ.

1.10) 'yy_flush_buffer undefined'    ϱ?

    õ  ƴմϴٸ  
ġ  Դϴ. PostgreSQL  ϱ ؼ flex 
ֱٹ (2.5.2, Ȥ  ̻)  ʿմϴ. flex 2.5.3  װ 
ϼ  3.4  ڼ ֽϴ.

1.11) a.out ýۿ  PostgreSQL  ؾ մϱ?

 dld ̺귯 ġؾ մϴ. Ʈ(Sunsite)  ġ
  ֽϴ.

     Linux/libs/dld.3.2.7.tar.gz (
     ftp://sunsite.unc.edu/pub/Linux/libs/dld.3.2.7.tar.gz)

׷ , src/Makefile.custom  Ʒ  ߰ϼ.

        LINUX_ELF=

(Ŀ͸ϴ ũƮ ص ˴ϴ)

1.12) make  ϴ ߿    Բ ϴ :

        yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
        make: /usr/bin/make: cannot execute binary file

Postgres95  ʱ ־ Դϴ. PostgreSQL  ⺻ yacc
 ƴ϶ bison -y  մϴ.

yacc  Ϲ bison -y  θ ũƮ ȴ.  
make   ũƮ Ű Ѵ. (make   ? bash 
 ?)   ذϱ ؼ src/mk/port/postgres.mk.linux
   

        #YACC = bison -y



        YACC = bison -y

 ٲپ ݴϴ.

1.13) src/Makefile.global  X11_LIB  ִ libsocket  libnsl 
۷ Դϱ?

1.08  ϴ. (Sun Solaris  ش˴ϴ) 1.09  6.0 
ϴ.

1.14) [] libtermcap   ֽϱ?

Debian Linux  termcap ̺귯  ʰ ncurses  մϴ.
(ncurses  terminfo  Ѵ) src/bin/psql/Makefile  CURSES_LIB 
 ʿ ϴ.   libncurses  libcurses 
ũ ϱ  . (SuSE- Դϴ --  1.8 
ϼ)

src/bin/psql/Makefile  Ͽ    ּ.

        ifeq ($(PORTNAME), linux)

            LD_ADD+= -ltermcap

̰   մϴ

        ifeq ($(PORTNAME), linux)

            LD_ADD+=

1.15) [] PostgreSQL  RPM ·   ֳ?

Դϴ! Michal Mosiewicz ( http://www.pdi.lodz.pl/~mimo)  ڿ
PostgreSQL V6.0 RPM Ű ؼ
ftp://ftp.redhat.org/pub/Incoming/Postgres-6.0-1.i386.rpm  ε
سҽϴ.

̰ ̸ ϵǾִ ̸ ҽ RPM     ִ
ġԴϴ. (1997 2 3)

1.16) Linux Ͽ   Ϸٰ   ޽ Բ
Ͽ ߽ϴ :

        In file included from /usr/include/sys/sem.h:8, from ipc.c:37:
        /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
        ....
        make: *** [ipc.o] Error 1

 ش ζ̴ Լ鿡  Ÿ  ʱ 
 Դϴ.   ذϷ .../src/backend/storage/ipc
丮 ִ Makefile  Ͽ    ־ մϴ.

        CFLAGS+=$(INCLUDE_OPT)

̰ Ʒ  ٲߴϴ.

        CFLAGS+=$(INCLUDE_OPT) -Wno-error

../src/backend/storage/lmgr 丮  ۾ ּ.

1.17) postgres  ϴ ߿ gcc  signal 11  ߻ǰ
ߴܵ˴ϴ. ڼ Ẹ,

        gcc: Internal compiler error: program cc1 got fatal signal 11

ϵ  ޸   ϴ. PostgreSQL  ſ ū α׷̸
gcc  ū α׷ ϴ  (PostgreSQL  ϰų Ŀ
ϴ ) ޸𸮿  ϸ ְ Ǹ,  Ȳ
Ͼ ʴ  ߻ų  ֽϴ.   ü
ϵ  ȤŰ ʱ    
ϴ   ֽϴ.

   ڼ   ҿ   ֽϴ.

     http://www.bitwizard.nl/sig11

̰ ִ Sig11 FAQ  ,  5.0  gcc  ̸ μ
  Ư    ϴ.  ڼ   URL 
ϼ.

1.18) MkLinux  6.1.1  ġ  ֽϱ?

Ÿ ̽ (Tatsuo Ishii)  MkLinux DR2.1 update2  ణ ġ 
Ŀ ġ ߽ϴ. ġ Ʒ ҿ   ֽϴ.

     ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/mklinux.patch.gz

1.19) make  ǰų ״  ?

gmake  ϷǱ  ϰų ׸Ʈ  Ųٴ 
־ϴ. ׸Ʈ  쿡 gmake 3.74  Ͼ, 3.76.1 
׷̵ϴ   ذ˴ϴ.  3.74  ٸ ȯ濡 
۵ϴ  ޷ ֽϴ.  , ̷  ٰ ϱ
 gmake  ֽŹ ׷̵ ñ ٶϴ.

1.20) 486 ̳ Ƽ ȭŰ  մϱ?

Ϸ ÷ ʱġδ 486 ̳ Ƽ ȭ  ʵ
Ǿ ֽϴ. ȭ Ϸ Makefile.custom    
߰ϼ.

        CFLAGS+= -m486

ƴϸ (  ǰ    Ϸ)

        CFLAGS+= -mpentium

Ǵ

        CFLAGS+= -mpentiumpro

  ------------------------------------------------------------------------

2 :  α׷ ϱ

  ------------------------------------------------------------------------

2.1) The linker fails to find libX11 when compiling pgtclsh 2.1) pgtclsh 
  Ŀ libX11  ã մϴ.

src/Makefile.custom    ߰ϼ.

        X11_LIBDIR = /usr/X11R6/lib

  ------------------------------------------------------------------------

3 :  

  ------------------------------------------------------------------------

3.1) createuser  ũƮ Ű    ɴϴ.

        _fUnKy_POSTPORT_sTuFf_ undefined

Postgres  1.06 1.07̿ ־ Դϴ.  1.08 ̻󿡼
Ǿϴ.

3.2) postmaster  Ű  'Bad system call(Core dumped) 
޽ ɴϴ.

 Ŀ ޸𸮸  ʵ  Ǿٴ Դϴ.
 Ŀ  ޸𸮸 ϵ  ߰ؾ մϴ.

3.3) postmaster  Ű ϸ    ϴ.

        Failed Assertion("!(file != 0):(null)", File:
        "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
        !(file != 0) (0)
        initdb: could not create template database
        initdb: cleaning up.

/dev/null   ۹̼ ߸Ǿ ֽϴ.

ls -l /dev/null  Ű  ϰ  Դϴ.

        crw-rw-rw-  1 root  wheel    2,   2 Oct  8 18:41 /dev/null

۹̼   ٲپ ּ.

        chmod a+rw /dev/null

3.4) createuser   ۵ ʳ?

GNU flex  2.5.3  createuser ̿  ֽϴ. flex  V2.5.2 
ٿ׷̵ϰų 2.5.4  ׷ص ǰ, V2.5.3  doc/README.flex
ȿ Ǵ ġ ѵ ˴ϴ. V2.5.4   ҿ  
ֽϴ.

     ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz

3.5)      ̴ϱ?:

        IpcMemoryCreate: memKey=155356396 , size=760632 ,
        permission=384IpcMemoryCreate: shmget(..., create, ...)
        failed: Invalid argument

 Ŀ IPC   ä  Ǿϴ. Ŀ ٽ
ϸ鼭  ɼ Ѿ մϴ.

3.6) psql  ̷ ޽ Բ ǰ ϴ:

        psql: can't load library 'libpq.so.1'

Psql  libpq ̺귯  ǵ ϵǾ ֽϴ.

  ذϷ root  αؼ   ؾ մϴ.

        /etc/ld.so.conf

 ٿ PostgreSQL ̺귯 丮 (PostgreSQL  ġ  lib
丮)  ˷ִ  ߰ ,  ŵϴ.

        /sbin/ldconfig -v

ٸ δ (  root    ʴٸ) LD_LIBRARY_PATH
ȯ溯   ֽϴ.

LD_LIBRARY_PATH ȯ溯  ̺귯 ˻  
ݷ(:) ؼ  ֽϴ.   ldconfig   
̺귯 ˻ϱ   ˴ϴ.

Bash    մϴ.

        export LD_LIBRARY_PATH='PathToPGSQL'/lib

tcsh  Ѵٸ

        setenv LD_LIBRARY_PATH 'PathToPGSQL'/lib

'PathToPGSQL'    PostgreSQL ġ 丮 ٲٸ ˴ϴ.

ldd  ϸ  Ǵ  ϴ
̺귯 θ    ֽϴ.

3.7) Ÿ ̻ 

 Ǵ   ѵ,  Ȯ     
δ libpq ̺귯 ùٸ  εϴ ؼ 캸.
̺귯  𿣰 (  /usr/lib )  ̺귯
ִٸ ڰ εϷ ߴ    ε 
ֽϴ.  ̺귯 Ȯ ְ,  3.6  
̺귯 ε λ ϼ.

3.8) PostgreSQL  ǰ ִµ ý ˴ٿ Ű Linux 
õǾ   fsck  ϰ ˴ϴ.

̷  ִٴ  ִµ, Ƹ INSTALL  õ 
PostgreSQL  /etc/inittab  ų  Ÿ  ϴ.

׷, postmaster  rc ũƮ ⵿Ű  õմϴ.
 迭  /etc/rc.d/rc.local  Ͽ Ʈ͸
⵿ų Դϴ.  迭 /etc/rc.d/init.d ̸ư 
ʷ Ͽ /etc/rc.d/rc3.d  SysV Ÿ ũƮ  մϴ.

contrib/linux/postgres.init    ֽϴ.

 κ   մϴ. ʿ信  ؼ .

#!/bin/sh
#
# postgreSQL.init This shell script takes care of starting and stopping
#               the PostgreSQL postmaster.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting postgres Postmaster daemon:"
        if [ -z "`pidofproc postmaster`" ]
        then
                su postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgreSQL/data -p 5432 &"
                echo -n " postmaster"
        else
                echo -n " (already running)"
        fi
        echo
        touch /var/lock/subsys/postgres
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down postgres Postmaster daemon: "
        killall -TERM postmaster 2>/dev/null
        killall -TERM postgres 2>/dev/null
        echo
        rm -f /var/lock/subsys/postgres
        ;;
  *)
        echo "Usage: postgres {start|stop}"
        exit 1
esac

exit 0

3.9) ȸ ׽Ʈ Query 32   ׷ ð  ɸϱ?

ȸ ũƮ  ڽ ߻Ǵ װ ֱ Դϴ. ̸
ذ    ˷ ֽϴ. (Ÿ ̷̽κ ) 1.
regress.sh   ϼ.

        time postgres -texecutor -tplanner -Q bench < bench.sql



        postgres -texecutor -tplanner -Q bench < bench.sql

 ٲٸ ˴ϴ. 2. ׽Ʈ Ų , bench.out   
  ϼ.

        85.86user 114.47system 4:49.20elapsed 69%CPU (0avgtext+0avgdata 0maxresident)k

׸  Էϼ.

        sh ./perquery < bench.out > & bench.out.perquery

3.10)  date/time 꿡 ݿø ̻ϰ ˴ϴ. select '4
hours'::timespan;  Ű '3 hours 59 minutes 60 seconds'  
ɴϴ.

ο glibc2 ̺귯 ϸ鼭 2.0.7  ϴ Դϴ.
̺귯 ݿøɿ  ֽϴ. ̺귯 ׷̵ϼ.
  ------------------------------------------------------------------------
