1. 04 Aug, 2002 3 commits
    • Bruce Momjian's avatar
      Attached are two patches to implement and document anonymous composite · 9218689b
      Bruce Momjian authored
      types for Table Functions, as previously proposed on HACKERS. Here is a
      brief explanation:
      
      1. Creates a new pg_type typtype: 'p' for pseudo type (currently either
           'b' for base or 'c' for catalog, i.e. a class).
      
      2. Creates new builtin type of typtype='p' named RECORD. This is the
           first of potentially several pseudo types.
      
      3. Modify FROM clause grammer to accept:
           SELECT * FROM my_func() AS m(colname1 type1, colname2 type1, ...)
           where m is the table alias, colname1, etc are the column names, and
           type1, etc are the column types.
      
      4. When typtype == 'p' and the function return type is RECORD, a list
           of column defs is required, and when typtype != 'p', it is
      disallowed.
      
      5. A check was added to ensure that the tupdesc provide via the parser
           and the actual return tupdesc match in number and type of
      attributes.
      
      When creating a function you can do:
           CREATE FUNCTION foo(text) RETURNS setof RECORD ...
      
      When using it you can do:
           SELECT * from foo(sqlstmt) AS (f1 int, f2 text, f3 timestamp)
             or
           SELECT * from foo(sqlstmt) AS f(f1 int, f2 text, f3 timestamp)
             or
           SELECT * from foo(sqlstmt) f(f1 int, f2 text, f3 timestamp)
      
      Included in the patches are adjustments to the regression test sql and
      expected files, and documentation.
      
      p.s.
           This potentially solves (or at least improves) the issue of builtin
           Table Functions. They can be bootstrapped as returning RECORD, and
           we can wrap system views around them with properly specified column
           defs. For example:
      
           CREATE VIEW pg_settings AS
             SELECT s.name, s.setting
             FROM show_all_settings()AS s(name text, setting text);
      
           Then we can also add the UPDATE RULE that I previously posted to
           pg_settings, and have pg_settings act like a virtual table, allowing
           settings to be queried and set.
      
      
      Joe Conway
      9218689b
    • Thomas G. Lockhart's avatar
      Implement IS OF and IS NOT OF type predicate. · eb121ba2
      Thomas G. Lockhart authored
       Can now do queries of the form: SELECT value IS OF (integer, float8);
      Define macros for handling typmod manipulation for date/time types.
       Should be more robust than all of that brute-force inline code.
      Rename macros for masking and typmod manipulation to put TIMESTAMP_
       or INTERVAL_ in front of the macro name, to reduce the possibility
       of name space collisions.
      Allow bit string constants without fully-specified length declaration.
      Try implementing CREATE TABLE/OF as a mapping to inheritance.
       May be appropriate, or may be replace later with something more exactly
       like one might expect from databases without the feature.
      eb121ba2
    • Bruce Momjian's avatar
      The attached patch implements START TRANSACTION, per SQL99. The · 19e0e35b
      Bruce Momjian authored
      functionality of the command is basically identical to that of
      BEGIN; it just accepts a few extra options (only one of which
      PostgreSQL currently implements), and is standards-compliant.
      The patch includes a simple regression test and documentation.
      
      [ Regression tests removed, per Peter.]
      
      Neil Conway
      19e0e35b
  2. 31 Jul, 2002 1 commit
    • Tom Lane's avatar
      Instead of having a configure-time DEFAULT_ATTSTATTARGET, store -1 in · ce7565ab
      Tom Lane authored
      attstattarget to indicate 'use the default'.  The default is now a GUC
      variable default_statistics_target, and so may be changed on the fly.  Along
      the way we gain the ability to have pg_dump dump the per-column statistics
      target when it's not the default.  Patch by Neil Conway, with some kibitzing
      from Tom Lane.
      ce7565ab
  3. 30 Jul, 2002 1 commit
  4. 29 Jul, 2002 1 commit
    • Tom Lane's avatar
      Implement CREATE/DROP OPERATOR CLASS. Work still remains: need more · ea4686e3
      Tom Lane authored
      documentation (xindex.sgml should be rewritten), need to teach pg_dump
      about it, need to update contrib modules that currently build pg_opclass
      entries by hand.  Original patch by Bill Studenmund, grammar adjustments
      and general update for 7.3 by Tom Lane.
      ea4686e3
  5. 24 Jul, 2002 1 commit
    • Peter Eisentraut's avatar
      Remove unused system table columns: · 739adf32
      Peter Eisentraut authored
      pg_language.lancompiler
      pg_operator.oprprec
      pg_operator.oprisleft
      pg_proc.proimplicit
      pg_proc.probyte_pct
      pg_proc.properbyte_cpu
      pg_proc.propercall_cpu
      pg_proc.prooutin_ratio
      pg_shadow.usetrace
      pg_type.typprtlen
      pg_type.typreceive
      pg_type.typsend
      
      Attempts to use the obsoleted attributes of pg_operator or pg_proc
      in the CREATE commands will be greeted by a warning.  For pg_type,
      there is no warning (yet) because pg_dump scripts still contain these
      attributes.
      
      Also remove new but already obsolete spellings
      isVolatile, isStable, isImmutable in WITH clause.  (Use new syntax
      instead.)
      739adf32
  6. 20 Jul, 2002 1 commit
  7. 18 Jul, 2002 6 commits
    • Peter Eisentraut's avatar
      pg_cast table, and standards-compliant CREATE/DROP CAST commands, plus · 97377048
      Peter Eisentraut authored
      extension to create binary compatible casts.  Includes dependency tracking
      as well.
      
      pg_proc.proimplicit is now defunct, but will be removed in a separate
      commit.
      
      pg_dump provides a migration path from the previous scheme to declare
      casts.  Dumping binary compatible casts is currently impossible, though.
      97377048
    • Bruce Momjian's avatar
      7d78bac1
    • Tom Lane's avatar
      Implement DROP SCHEMA. It lacks support for dropping conversions and · 11333426
      Tom Lane authored
      operator classes, both of which are schema-local and so should really
      be droppable.
      11333426
    • Bruce Momjian's avatar
      The attached patch (against HEAD) implements · a90db34b
      Bruce Momjian authored
        COPY x (a,d,c,b) from stdin;
        COPY x (a,c) to stdout;
      
      as well as the corresponding changes to pg_dump to use the new
      functionality.  This functionality is not available when using
      the BINARY option.  If a column is not specified in the COPY FROM
      statement, its default values will be used.
      
      In addition to this functionality, I tweaked a couple of the
      error messages emitted by the new COPY <options> checks.
      
      Brent Verner
      a90db34b
    • Bruce Momjian's avatar
      Finished the Between patch Christopher started. · 3e22406e
      Bruce Momjian authored
      Implements between (symmetric / asymmetric) as a node.
      
      Executes the left or right expression once, makes a Const out of the
      resulting Datum and executes the >=, <= portions out of the Const sets.
      
      Of course, the parser does a fair amount of preparatory work for this to
      happen.
      
      Rod Taylor
      3e22406e
    • Tatsuo Ishii's avatar
      I have committed many support files for CREATE CONVERSION. Default · eb335a03
      Tatsuo Ishii authored
      conversion procs and conversions are added in initdb. Currently
      supported conversions are:
      
      UTF-8(UNICODE) <--> SQL_ASCII, ISO-8859-1 to 16, EUC_JP, EUC_KR,
      		    EUC_CN, EUC_TW, SJIS, BIG5, GBK, GB18030, UHC,
      		    JOHAB, TCVN
      
      EUC_JP <--> SJIS
      EUC_TW <--> BIG5
      MULE_INTERNAL <--> EUC_JP, SJIS, EUC_TW, BIG5
      
      Note that initial contents of pg_conversion system catalog are created
      in the initdb process. So doing initdb required is ideal, it's
      possible to add them to your databases by hand, however. To accomplish
      this:
      
      psql -f your_postgresql_install_path/share/conversion_create.sql your_database
      
      So I did not bump up the version in cataversion.h.
      
      TODO:
      Add more conversion procs
      Add [CASCADE|RESTRICT] to DROP CONVERSION
      Add tuples to pg_depend
      Add regression tests
      Write docs
      Add SQL99 CONVERT command?
      --
      Tatsuo Ishii
      eb335a03
  8. 16 Jul, 2002 1 commit
  9. 14 Jul, 2002 1 commit
  10. 12 Jul, 2002 1 commit
    • Tom Lane's avatar
      Second phase of committing Rod Taylor's pg_depend/pg_constraint patch. · 7c6df91d
      Tom Lane authored
      pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY
      constraints all have real live entries in pg_constraint.  pg_depend
      exists, and RESTRICT/CASCADE options work on most kinds of DROP;
      however, pg_depend is not yet very well populated with dependencies.
      (Most of the ones that are present at this point just replace formerly
      hardwired associations, such as the implicit drop of a relation's pg_type
      entry when the relation is dropped.)  Need to add more logic to create
      dependency entries, improve pg_dump to dump constraints in place of
      indexes and triggers, and add some regression tests.
      7c6df91d
  11. 11 Jul, 2002 1 commit
    • Tatsuo Ishii's avatar
      Add new CREATE CONVERSION/DROP CONVERSION command. · fcc96256
      Tatsuo Ishii authored
      This is the first cut toward CREATE CONVERSION/DROP CONVERSION implementaion.
      The commands can now add/remove tuples to the new pg_conversion system
      catalog, but that's all. Still need work to make them actually working.
      Documentations, regression tests also need work.
      fcc96256
  12. 06 Jul, 2002 1 commit
  13. 04 Jul, 2002 1 commit
    • Thomas G. Lockhart's avatar
      Implement the IS DISTINCT FROM operator per SQL99. · 68d9fbeb
      Thomas G. Lockhart authored
      Reused the Expr node to hold DISTINCT which strongly resembles
       the existing OP info. Define DISTINCT_EXPR which strongly resembles
       the existing OPER_EXPR opType, but with handling for NULLs required
       by SQL99.
      We have explicit support for single-element DISTINCT comparisons
       all the way through to the executor. But, multi-element DISTINCTs
       are handled by expanding into a comparison tree in gram.y as is done for
       other row comparisons. Per discussions, it might be desirable to move
       this into one or more purpose-built nodes to be handled in the backend.
      Define the optional ROW keyword and token per SQL99.
       This allows single-element row constructs, which were formerly disallowed
       due to shift/reduce conflicts with parenthesized a_expr clauses.
      Define the SQL99 TREAT() function. Currently, use as a synonym for CAST().
      68d9fbeb
  14. 01 Jul, 2002 1 commit
    • Tom Lane's avatar
      First phase of applying Rod Taylor's pg_depend patch. This just adds · 131f801d
      Tom Lane authored
      RESTRICT/CASCADE syntax to the DROP commands that need it, and propagates
      the behavioral option through the parser to the routines that execute
      drops.  Doesn't do anything useful yet, but I figured I'd commit these
      changes so I could get out of the parser area while working on the rest.
      131f801d
  15. 22 Jun, 2002 1 commit
    • Thomas G. Lockhart's avatar
      Implement SQL99 CREATE CAST and DROP CAST statements. · 90edb265
      Thomas G. Lockhart authored
       Also implement alternative forms to expose the PostgreSQL CREATE FUNCTION
       features.
      Implement syntax for READ ONLY and READ WRITE clauses in SET TRANSACTION.
       READ WRITE is already implemented (of course).
      Implement syntax for "LIKE table" clause in CREATE TABLE. Should be fairly
       easy to complete since it resembles SELECT INTO.
      Implement MATCH SIMPLE clause for foreign key definitions. This is explicit
       SQL99 syntax for the default behavior, so we now support it :)
      Start implementation of shorthand for national character literals in
       scanner. For now, just swallow the leading "N", but sometime soon let's
       figure out how to pass leading type info from the scanner to the parser.
       We should use the same technique for binary and hex bit string literals,
       though it might be unusual to have two apparently independent literal
       types fold into the same storage type.
      90edb265
  16. 20 Jun, 2002 2 commits
  17. 19 Jun, 2002 1 commit
  18. 18 Jun, 2002 3 commits
  19. 17 Jun, 2002 4 commits
  20. 15 Jun, 2002 1 commit
    • Thomas G. Lockhart's avatar
      Add LOCALTIME and LOCALTIMESTAMP functions per SQL99 standard. · 133df7ce
      Thomas G. Lockhart authored
      Remove ODBC-compatible empty parentheses from calls to SQL99 functions
       for which these parentheses do not match the standard.
      Update the ODBC driver to ensure compatibility with the ODBC standard
       for these functions (e.g. CURRENT_TIMESTAMP, CURRENT_USER, etc).
      Include a new appendix in the User's Guide which lists the labeled features
       for SQL99 (the labeled features replaced the "basic", "intermediate",
       and "advanced" categories from SQL92). features.sgml does not yet split
       this list into "supported" and "unsupported" lists.
      133df7ce
  21. 13 Jun, 2002 1 commit
  22. 11 Jun, 2002 2 commits
    • Thomas G. Lockhart's avatar
      Implement SQL99 OVERLAY(). Allows substitution of a substring in a string. · ea01a451
      Thomas G. Lockhart authored
      Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
      Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
       Extend the definition to make the FOR clause optional.
       Define textregexsubstr() to actually implement this feature.
      Update the regression test to include these new string features.
       All tests pass.
      Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
      Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
      ea01a451
    • Jan Wieck's avatar
      Katherine Ward wrote: · 469cb65a
      Jan Wieck authored
      > Changes to avoid collisions with WIN32 & MFC names...
      > 1.  Renamed:
      >       a.  PROC => PGPROC
      >       b.  GetUserName() => GetUserNameFromId()
      >       c.  GetCurrentTime() => GetCurrentDateTime()
      >       d.  IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim
      >
      > 2.  Added _P to some lex/yacc tokens:
      >       CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT
      
      Jan
      469cb65a
  23. 22 May, 2002 1 commit
    • Peter Eisentraut's avatar
      Add optional "validator" function to languages that can validate the · d60f10b0
      Peter Eisentraut authored
      function body (and other properties) as a function in the language
      is created.  This generalizes ad hoc code that already existed for
      the built-in languages.
      
      The validation now happens after the pg_proc tuple of the new function
      is created, so it is possible to define recursive SQL functions.
      
      Add some regression test cases that cover bogus function definition
      attempts.
      d60f10b0
  24. 19 May, 2002 1 commit
  25. 17 May, 2002 2 commits