linux

postgresql create languange plpgsql on ubuntu

ubuntu have it’s own way to create language plpgsql;

you have to install package postgresql-contrib
and update query from dblink.sql
:-)

template1=# SELECT true FROM pg_catalog.pg_language WHERE lanname = 'plpgsql';
 bool
------
(0 rows)

template1=# SELECT * FROM pg_catalog.pg_language;
 lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | lanvalidator | lanacl
----------+----------+---------+--------------+---------------+--------------+--------
 internal |       10 | f       | f            |             0 |         2246 |
 c        |       10 | f       | f            |             0 |         2247 |
 sql      |       10 | f       | t            |             0 |         2248 |
(3 rows)


root@pi:~# apt-get install postgresql-contrib


root@pi:~# locate dblink
/usr/lib/postgresql/8.3/lib/dblink.so
/usr/share/postgresql/8.3/contrib/dblink.sql
/usr/share/postgresql/8.3/contrib/uninstall_dblink.sql
root@pi:~# su - postgres
postgres@pi:~$ psql pxx < /usr/share/postgresql/8.3/contrib/dblink.sql

pxx=# CREATE LANGUAGE plpgsql pxx;
ERROR:  syntax error at or near "pxx"
LINE 1: CREATE LANGUAGE plpgsql pxx;
                                ^
pxx=# CREATE LANGUAGE plpgsql;
CREATE LANGUAGE


pxx=# SELECT * FROM pg_catalog.pg_language;
 lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | lanvalidator | lanacl
----------+----------+---------+--------------+---------------+--------------+--------
 internal |       10 | f       | f            |             0 |         2246 |
 c        |       10 | f       | f            |             0 |         2247 |
 sql      |       10 | f       | t            |             0 |         2248 |
 plpgsql  |       10 | t       | t            |         16552 |        16553 |
(4 rows)


logwatch error because of undefined timezone

yesterday I changed timezone on my server. And I got report about this error:

ERROR: Date::Manip unable to determine TimeZone.

Execute the following command in a shell prompt:
        perldoc Date::Manip
The section titled TIMEZONES describes valid TimeZones
and where they can be defined.

you should read documentation of perl module Date::Manip to define your timezone.
This is what the list of timezone that I have got from ‘perldoc Date::Manip’.

TIME ZONES
       The following time zone names are currently understood (and can be used in parsing dates).  These are zones defined in RFC 822.

           Universal:  GMT, UT
           US zones :  EST, EDT, CST, CDT, MST, MDT, PST, PDT
           Military :  A to Z (except J)
           Other    :  +HHMM or -HHMM
           ISO 8601 :  +HH:MM, +HH, -HH:MM, -HH

       In addition, the following time zone abbreviations are also accepted.  In a few cases, the same abbreviation is used for two different time zones
       (for example, NST stands for Newfoundland Standard -0330 and North Sumatra +0630).  In these cases, only 1 of the two is available.  The one pre-
       ceded by a "#" sign is NOT available but is documented here for completeness.  This list of zones comes in part from the Time::Zone module by Gra-
       ham Barr, David Muir Sharnoff, and Paul Foley (with several additions by myself).

             IDLW    -1200    International Date Line West
             NT      -1100    Nome
             HST     -1000    Hawaii Standard
             CAT     -1000    Central Alaska
             AHST    -1000    Alaska-Hawaii Standard
             AKST    -0900    Alaska Standard
             YST     -0900    Yukon Standard
             HDT     -0900    Hawaii Daylight
             AKDT    -0800    Alaska Daylight
             YDT     -0800    Yukon Daylight
             PST     -0800    Pacific Standard
             PDT     -0700    Pacific Daylight
             MST     -0700    Mountain Standard
             MDT     -0600    Mountain Daylight
             CST     -0600    Central Standard
             CDT     -0500    Central Daylight
             EST     -0500    Eastern Standard
             ACT     -0500    Brazil, Acre
             PET     -0500    Peruvian Time
             VET     -0430    Venezuela
             SAT     -0400    Chile
             CLT     -0400    Chile Standard
             CLST    -0400    Chile Standard
             BOT     -0400    Bolivia
             EDT     -0400    Eastern Daylight
             AST     -0400    Atlantic Standard
             AMT     -0400    Brazil, Amazon
             ACST    -0400    Brazil, Acre Daylight
            #NST     -0330    Newfoundland Standard       nst=North Sumatra    +0630
             NFT     -0330    Newfoundland
             CLDT    -0300    Chile Daylight
            #GST     -0300    Greenland Standard          gst=Guam Standard    +1000
            #BST     -0300    Brazil Standard             bst=British Summer   +0100
            #BRST    -0300    Brazil Standard
             BRT     -0300    Brazil Standard
             AMST    -0300    Brazil, Amazon Daylight
             ADT     -0300    Atlantic Daylight
             ART     -0300    Argentina
             UYT     -0300    Uruguay
             NDT     -0230    Newfoundland Daylight
             ARST    -0200    Argentina Daylight
             AT      -0200    Azores
             BRST    -0200    Brazil Daylight (official time)
             FNT     -0200    Brazil, Fernando de Noronha
             UYST    -0200    Uruguay
             WAT     -0100    West Africa
             FNST    -0100    Brazil, Fernando de Noronha Daylight
             GMT     +0000    Greenwich Mean
             UT      +0000    Universal (Coordinated)
             UTC     +0000    Universal (Coordinated)
             WET     +0000    Western European
             CET     +0100    Central European
             FWT     +0100    French Winter
             MET     +0100    Middle European
             MEZ     +0100    Middle European
             MEWT    +0100    Middle European Winter
             SWT     +0100    Swedish Winter
             BST     +0100    British Summer              bst=Brazil standard  -0300
             GB      +0100    GMT with daylight saving
             WEST    +0100    Western European Daylight
             CEST    +0200    Central European Summer
             EET     +0200    Eastern Europe, USSR Zone 1
             FST     +0200    French Summer
             MEST    +0200    Middle European Summer
             MESZ    +0200    Middle European Summer
             METDST  +0200    An alias for MEST used by HP-UX
             SAST    +0200    South African Standard
             SST     +0200    Swedish Summer              sst=South Sumatra    +0700
             EEST    +0300    Eastern Europe Summer
             EETDST  +0300    An alias for eest used by HP-UX
             BT      +0300    Baghdad, USSR Zone 2
             MSK     +0300    Moscow
             EAT     +0300    East Africa
             IT      +0330    Iran
             ZP4     +0400    USSR Zone 3
             MSD     +0300    Moscow Daylight
             ZP5     +0500    USSR Zone 4
             YEKT    +0500    Yeakaterinburg time zone, Russia
             YEKST   +0500    Yeakaterinburg summer time zone, Russia
             IST     +0530    Indian Standard
             ZP6     +0600    USSR Zone 5
             NOVT    +0600    Novosibirsk winter time zone, Russia
             OMST    +0600    Omsk time zone, Russia
             NST     +0630    North Sumatra               nst=Newfoundland Std -0330
            #SST     +0700    South Sumatra, USSR Zone 6  sst=Swedish Summer   +0200
             JAVT    +0700    Java
             NOVST   +0700    Novosibirsk summer time zone, Russia
             ICT     +0700    Indo China Time
             KRAT    +0700    Krasnoyarsk, Russia
             MYT     +0800    Malaysia
             CCT     +0800    China Coast, USSR Zone 7
             KRAST   +0800    Krasnoyarsk, Russia Daylight
             AWST    +0800    Australian Western Standard
             WST     +0800    West Australian Standard
             PHT     +0800    Asia Manila
             JST     +0900    Japan Standard, USSR Zone 8
             ROK     +0900    Republic of Korea
             ACST    +0930    Australian Central Standard
             CAST    +0930    Central Australian Standard
             AEST    +1000    Australian Eastern Standard
             EAST    +1000    Eastern Australian Standard
             GST     +1000    Guam Standard, USSR Zone 9  gst=Greenland Std    -0300
             CHST    +1000    Guam Standard, USSR Zone 9  gst=Greenland Std    -0300
             ACDT    +1030    Australian Central Daylight
             CADT    +1030    Central Australian Daylight
             AEDT    +1100    Australian Eastern Daylight
             EADT    +1100    Eastern Australian Daylight
             IDLE    +1200    International Date Line East
             NZST    +1200    New Zealand Standard
             NZT     +1200    New Zealand
             NZDT    +1300    New Zealand Daylight

       Others can be added in the future upon request.

       Date::Manip must be able to determine the time zone the user is in.  It does this by looking in the following places:

          $Date::Manip::TZ (set with Date_Init or in Manip.pm)
          $ENV{TZ}
          the Unix `date` command (if available)
          $main::TZ
          /etc/TIMEZONE
          /etc/timezone

       At least one of these should contain a time zone in one of the supported forms.  If none do by default, the TZ variable must be set with Date_Init.

       The time zone may be in the STD#DST format (in which case both abbreviations must be in the table above) or any of the formats described above.
       The STD#DST format is NOT available when parsing a date however.  The following forms are also available and are treated similar to the STD#DST
       forms:

             US/Pacific
             US/Mountain
             US/Central
             US/Eastern
             Canada/Pacific
             Canada/Mountain
             Canada/Central
             Canada/Eastern

I configure the timezone using command ‘dpkg-reconfigure tzdata’,
And my /etc/timezone consist of unknown format for perl module Date::Manip.
the content of /etc/timezone should change into one of the format above.

in this case, i use timezone JAVT. because I love Java ;-)


  • Copyright © 1996-2010 vaks.in. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress