Seth Woolley's Man Viewer

Manual for set - man 7 set

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

SET(7)                           SQL Commands                           SET(7)

       SET - change a run-time parameter

       SET [ SESSION | LOCAL ] name { TO | = } { value | 'value' | DEFAULT }
       SET [ SESSION | LOCAL ] TIME ZONE { timezone | LOCAL | DEFAULT }

       The  SET command changes run-time configuration parameters. Many of the
       run-time parameters listed in(1,8) the section called ``Run-time  Configura-
       tion''  in(1,8)  the documentation can be changed on-the-fly with SET.  (But
       some require superuser privileges  to  change,  and  others  cannot  be
       changed  after  server  or  session start.)  SET only affects the value
       used by the current session.

       If SET or SET SESSION is issued within  a  transaction  that  is  later
       aborted,  the effects of the SET command disappear when the transaction
       is rolled back. (This behavior represents a change from PostgreSQL ver-
       sions  prior to 7.3, where the effects of SET would not roll back after
       a later error.) Once the  surrounding  transaction  is  committed,  the
       effects will persist until the end of the session, unless overridden by
       another SET.

       The effects of SET LOCAL last only till the end of the current transac-
       tion,  whether  committed or not. A special case is SET followed by SET
       LOCAL within a single transaction: the SET LOCAL  value  will  be  seen
       until the end of the transaction, but afterwards (if(3,n) the transaction is
       committed) the SET value will take effect.

              Specifies that the command takes effect for the current session.
              (This is the default if(3,n) neither SESSION nor LOCAL appears.)

       LOCAL  Specifies  that  the  command  takes effect for only the current
              transaction. After COMMIT or ROLLBACK, the session-level setting
              takes  effect  again. Note that SET LOCAL will appear to have no
              effect if(3,n) it is executed outside a BEGIN block, since the trans-
              action will end immediately.

       name   Name  of a settable run-time parameter. Available parameters are
              documented in(1,8) the section called ``Run-time  Configuration''  in(1,8)
              the documentation and below.

       value  New  value  of parameter. Values can be specified as string(3,n) con-
              stants, identifiers, numbers, or comma-separated lists of these.
              DEFAULT  can  be  used to specify resetting the parameter to its
              default value.

       Besides the configuration parameters documented in(1,8) the  section  called
       ``Run-time  Configuration''  in(1,8) the documentation, there are a few that
       can only be adjusted using the SET command or that have a special  syn-

       NAMES  SET NAMES value is an alias for SET client_encoding TO value.

       SEED   Sets  the  internal  seed  for  the random(3,4,6) number generator (the
              function random(3,4,6)).  Allowed  values  are  floating-point  numbers
              between 0 and 1, which are then multiplied by 231-1.

              The seed can also be set(7,n,1 builtins) by invoking the function setseed:

              SELECT setseed(value);

       TIME ZONE
              SET  TIME  ZONE value is an alias for SET timezone TO value. The
              syntax SET TIME ZONE allows special syntax  for  the  time(1,2,n)  zone
              specification.  Here are examples of valid values (but note some
              are accepted only on some platforms):

                     The time(1,2,n) zone for Berkeley, California.

                     The time(1,2,n) zone for Portugal.

                     The time(1,2,n) zone for Italy.

              -7     The time(1,2,n) zone 7 hours west from UTC (equivalent to  PDT).
                     Positive values are east from UTC.

              INTERVAL '-08:00' HOUR TO MINUTE
                     The  time(1,2,n) zone 8 hours west from UTC (equivalent to PST).


                     Set the time(1,2,n) zone to your local time(1,2,n) zone (the  one  that
                     the server's operating system defaults to).

       See  the  section  called  ``Date/Time Types'' in(1,8) the documentation for
       more information about time(1,2,n) zones.

       The function set_config provides equivalent functionality. See the sec-
       tion called ``Miscellaneous Functions'' in(1,8) the documentation.

       Set the schema search path:

       SET search_path TO my_schema, public;

       Set the style of date to traditional POSTGRES with ``day before month''
       input convention:

       SET datestyle TO postgres, dmy;

       Set the time(1,2,n) zone for Berkeley, California, using  quotes  to  preserve
       the uppercase spelling of the time(1,2,n) zone name:

       SELECT current_timestamp AS today;

        2003-04-29 15:02:01.218622-07

       SET  TIME ZONE extends syntax defined in(1,8) the SQL standard. The standard
       allows only numeric time(1,2,n) zone  offsets  while  PostgreSQL  allows  more
       flexible  time-zone  specifications.  All  other SET features are Post-
       greSQL extensions.

       RESET [reset(1,7,1 tput)(7)], SHOW [show(l)]

SQL - Language Statements         2003-11-02                            SET(7)

References for this manual (incoming links)