1. 19 Apr, 2002 1 commit
    • Tom Lane's avatar
      pg_trigger's index on tgrelid is replaced by a unique index on · 20173716
      Tom Lane authored
      (tgrelid, tgname).  This provides an additional check on trigger name
      uniqueness per-table (which was already enforced by the code anyway).
      With this change, RelationBuildTriggers will read the triggers in
      order by tgname, since it's scanning using this index.  Since a
      predictable trigger ordering has been requested for some time, document
      this behavior as a feature.  Also document that rules fire in name
      order, since yesterday's changes to pg_rewrite indexing cause that too.
      20173716
  2. 18 Apr, 2002 1 commit
    • Tom Lane's avatar
      Rule names are now unique per-relation, rather than unique globally. · b3120804
      Tom Lane authored
      DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause,
      similar to TRIGGER syntaxes.  To allow loading of existing pg_dump
      files containing COMMENT ON RULE, the COMMENT code will still accept
      the old syntax --- but only if the target rulename is unique across
      the whole database.
      b3120804
  3. 17 Apr, 2002 1 commit
    • Tom Lane's avatar
      Opclasses live in namespaces. I also took the opportunity to create · 27a54ae2
      Tom Lane authored
      an 'opclass owner' column in pg_opclass.  Nothing is done with it at
      present, but since there are plans to invent a CREATE OPERATOR CLASS
      command soon, we'll probably want DROP OPERATOR CLASS too, which
      suggests that a notion of ownership would be a good idea.
      27a54ae2
  4. 16 Apr, 2002 1 commit
    • Tom Lane's avatar
      Operators live in namespaces. CREATE/DROP/COMMENT ON OPERATOR take · 6cef5d25
      Tom Lane authored
      qualified operator names directly, for example CREATE OPERATOR myschema.+
      ( ... ).  To qualify an operator name in an expression you need to write
      OPERATOR(myschema.+) (thanks to Peter for suggesting an escape hatch).
      I also took advantage of having to reformat pg_operator to fix something
      that'd been bugging me for a while: mergejoinable operators should have
      explicit links to the associated cross-data-type comparison operators,
      rather than hardwiring an assumption that they are named < and >.
      6cef5d25
  5. 15 Apr, 2002 1 commit
    • Bruce Momjian's avatar
      CATALOG VERSION UPDATED: · bbae09c2
      Bruce Momjian authored
      The indexes on most system catalogs are named with the suffix "_index";
      not so with TOAST table indexes, which use "_idx". This trivial patch
      changes TOAST table index names to use the "_index" suffix for
      consistency.
      
      Neil Conway
      bbae09c2
  6. 11 Apr, 2002 1 commit
    • Tom Lane's avatar
      Restructure representation of aggregate functions so that they have pg_proc · 902a6a0a
      Tom Lane authored
      entries, per pghackers discussion.  This fixes aggregates to live in
      namespaces, and also simplifies/speeds up lookup in parse_func.c.
      Also, add a 'proimplicit' flag to pg_proc that controls whether a type
      coercion function may be invoked implicitly, or only explicitly.  The
      current settings of these flags are more permissive than I would like,
      but we will need to debate and refine the behavior; for now, I avoided
      breaking regression tests as much as I could.
      902a6a0a
  7. 05 Apr, 2002 1 commit
  8. 29 Mar, 2002 1 commit
  9. 26 Mar, 2002 1 commit
  10. 22 Mar, 2002 2 commits
  11. 21 Mar, 2002 1 commit
    • Tom Lane's avatar
      First phase of SCHEMA changes, concentrating on fixing the grammar and · 95ef6a34
      Tom Lane authored
      the parsetree representation.  As yet we don't *do* anything with schema
      names, just drop 'em on the floor; but you can enter schema-compatible
      command syntax, and there's even a primitive CREATE SCHEMA command.
      No doc updates yet, except to note that you can now extract a field
      from a function-returning-row's result with (foo(...)).fieldname.
      95ef6a34
  12. 20 Mar, 2002 1 commit
  13. 12 Mar, 2002 1 commit
    • Tom Lane's avatar
      Restructure representation of join alias variables. An explicit JOIN · 6eeb95f0
      Tom Lane authored
      now has an RTE of its own, and references to its outputs now are Vars
      referencing the JOIN RTE, rather than CASE-expressions.  This allows
      reverse-listing in ruleutils.c to use the correct alias easily, rather
      than painfully reverse-engineering the alias namespace as it used to do.
      Also, nested FULL JOINs work correctly, because the result of the inner
      joins are simple Vars that the planner can cope with.  This fixes a bug
      reported a couple times now, notably by Tatsuo on 18-Nov-01.  The alias
      Vars are expanded into COALESCE expressions where needed at the very end
      of planning, rather than during parsing.
      Also, beginnings of support for showing plan qualifier expressions in
      EXPLAIN.  There are probably still cases that need work.
      initdb forced due to change of stored-rule representation.
      6eeb95f0
  14. 01 Mar, 2002 1 commit
  15. 18 Feb, 2002 1 commit
  16. 12 Jan, 2002 1 commit
  17. 28 Oct, 2001 1 commit
  18. 25 Oct, 2001 2 commits
  19. 18 Oct, 2001 1 commit
    • Thomas G. Lockhart's avatar
      Accept an INTERVAL argument for SET TIME ZONE per SQL99. · 9310075a
      Thomas G. Lockhart authored
       Modified the parser and the SET handlers to use full Node structures
       rather than simply a character string argument.
      Implement INTERVAL() YEAR TO MONTH (etc) syntax per SQL99.
       Does not yet accept the goofy string format that goes along with, but
       this should be fairly straight forward to fix now as a bug or later
       as a feature.
      Implement precision for the INTERVAL() type.
       Use the typmod mechanism for both of INTERVAL features.
      Fix the INTERVAL syntax in the parser:
       opt_interval was in the wrong place.
      INTERVAL is now a reserved word, otherwise we get reduce/reduce errors.
      Implement an explicit date_part() function for TIMETZ.
       Should fix coersion problem with INTERVAL reported by Peter E.
      Fix up some error messages for date/time types.
       Use all caps for type names within message.
      Fix recently introduced side-effect bug disabling 'epoch' as a recognized
       field for date_part() etc. Reported by Peter E. (??)
      Bump catalog version number.
      Rename "microseconds" current transaction time field
       from ...Msec to ...Usec. Duh!
      date/time regression tests updated for reference platform, but a few
       changes will be necessary for others.
      9310075a
  20. 03 Oct, 2001 2 commits
    • Tom Lane's avatar
      Some further kibitzing on cachability of datetime functions. · 2b7ccb17
      Tom Lane authored
      In particular, mark all I/O functions that can produce or consume
      a date as noncachable, in light of existence of DateStyle variable.
      2b7ccb17
    • Thomas G. Lockhart's avatar
      Implement precision support for timestamp and time, both with and without · 3e1beda2
      Thomas G. Lockhart authored
       time zones.
      SQL99 spec requires a default of zero (round to seconds) which is set
       in gram.y as typmod is set in the parse tree. We *could* change to a
       default of either 6 (for internal compatibility with previous versions)
       or 2 (for external compatibility with previous versions).
      Evaluate entries in pg_proc wrt the iscachable attribute for timestamp and
       other date/time types. Try to recognize cases where side effects like the
       current time zone setting may have an effect on results to decide whether
       something is cachable or not.
      3e1beda2
  21. 28 Sep, 2001 1 commit
    • Thomas G. Lockhart's avatar
      Measure the current transaction time to milliseconds. · 6f58115d
      Thomas G. Lockhart authored
      Define a new function, GetCurrentTransactionStartTimeUsec() to get the time
       to this precision.
      Allow now() and timestamp 'now' to use this higher precision result so
       we now have fractional seconds in this "constant".
      Add timestamp without time zone type.
      Move previous timestamp type to timestamp with time zone.
      Accept another ISO variant for date/time values: yyyy-mm-ddThh:mm:ss
       (note the "T" separating the day from hours information).
      Remove 'current' from date/time types; convert to 'now' in input.
      Separate time and timetz regression tests.
      Separate timestamp and timestamptz regression test.
      6f58115d
  22. 14 Sep, 2001 1 commit
    • Bruce Momjian's avatar
      > Here's a revised patch. Changes: · c1fbf066
      Bruce Momjian authored
      >
      > 1. Now outputs '\\' instead of '\134' when using encode(bytea, 'escape')
      > Note that I ended up leaving \0 as \000 so that there are no ambiguities
      > when decoding something like, for example, \0123.
      >
      > 2. Fixed bug in byteain which allowed input values which were not valid
      > octals (e.g. \789), to be parsed as if they were octals.
      >
      > Joe
      >
      
      Here's rev 2 of the bytea string support patch. Changes:
      
      1. Added missing declaration for MatchBytea function
      2. Added PQescapeBytea to fe-exec.c
      3. Applies cleanly on cvs tip from this afternoon
      
      I'm hoping that someone can review/approve/apply this before beta starts, so
      I guess I'd vote (not that it counts for much) to delay beta a few days :-)
      
      Joe Conway
      c1fbf066
  23. 08 Sep, 2001 1 commit
    • Peter Eisentraut's avatar
      Make the world somewhat safe for (not from) DELETE FROM pg_shadow; · c0d4d547
      Peter Eisentraut authored
      Assign the fixed user id 1 to the user created by initdb.
      A stand-alone backend will always set the user id to 1.
      (Consequently, the name of that user is no longer important.)
      
      In stand-alone mode, the user id 1 will have implicit superuser
      status, to allow repairs even if there are no users defined.
      
      Print a warning message when starting in stand-alone mode when no
      users are defined.
      
      Disallow dropping the current user and session user.
      
      Granting/revoking superuser status also grants/revokes usecatupd.
      (Previously, it would never grant it back.  This could lead to "deadlocks".)
      
      CREATE USER and CREATE GROUP will start allocating user ids at 100
      (unless explicitly specified), to prevent accidental creation of a
      superuser (plus some room for future extensions).
      c0d4d547
  24. 26 Aug, 2001 1 commit
  25. 25 Aug, 2001 1 commit
    • Tom Lane's avatar
      Replace implementation of pg_log as a relation accessed through the · 2589735d
      Tom Lane authored
      buffer manager with 'pg_clog', a specialized access method modeled
      on pg_xlog.  This simplifies startup (don't need to play games to
      open pg_log; among other things, OverrideTransactionSystem goes away),
      should improve performance a little, and opens the door to recycling
      commit log space by removing no-longer-needed segments of the commit
      log.  Actual recycling is not there yet, but I felt I should commit
      this part separately since it'd still be useful if we chose not to
      do transaction ID wraparound.
      2589735d
  26. 21 Aug, 2001 1 commit
    • Tom Lane's avatar
      Restructure pg_opclass, pg_amop, and pg_amproc per previous discussions in · f933766b
      Tom Lane authored
      pgsql-hackers.  pg_opclass now has a row for each opclass supported by each
      index AM, not a row for each opclass name.  This allows pg_opclass to show
      directly whether an AM supports an opclass, and furthermore makes it possible
      to store additional information about an opclass that might be AM-dependent.
      pg_opclass and pg_amop now store "lossy" and "haskeytype" information that we
      previously expected the user to remember to provide in CREATE INDEX commands.
      Lossiness is no longer an index-level property, but is associated with the
      use of a particular operator in a particular index opclass.
      
      Along the way, IndexSupportInitialize now uses the syscaches to retrieve
      pg_amop and pg_amproc entries.  I find this reduces backend launch time by
      about ten percent, at the cost of a couple more special cases in catcache.c's
      IndexScanOK.
      
      Initial work by Oleg Bartunov and Teodor Sigaev, further hacking by Tom Lane.
      
      initdb forced.
      f933766b
  27. 16 Aug, 2001 1 commit
    • Tom Lane's avatar
      Sequences are now based on int8, not int4, arithmetic. SERIAL pseudo-type · d4f4b971
      Tom Lane authored
      has an alias SERIAL4 and a sister SERIAL8.  SERIAL8 is just the same
      except the created column is type int8 not int4.
      initdb forced.  Note this also breaks any chance of pg_upgrade from 7.1,
      unless we hack up pg_upgrade to drop and recreate sequences.  (Which is
      not out of the question, but I don't wanna do it.)
      d4f4b971
  28. 14 Aug, 2001 1 commit
    • Tom Lane's avatar
      sum() on int2 and int4 columns now uses an int8, not numeric, accumulator · 5f7c2bdb
      Tom Lane authored
      for speed reasons; its result type also changes to int8.  avg() on these
      datatypes now accumulates the running sum in int8 for speed; but we still
      deliver the final result as numeric, so that fractional accuracy is
      preserved.
      
      count() now counts and returns in int8, not int4.  I am a little nervous
      about this possibly breaking users' code, but there didn't seem to be
      a strong sentiment for avoiding the problem.  If we get complaints during
      beta, we can change count back to int4 and add a "count8" aggregate.
      For that matter, users can do it for themselves with a simple CREATE
      AGGREGATE command; the int4inc function is still present, so no C hacking
      is needed.
      
      Also added max() and min() aggregates for OID that do proper unsigned
      comparison, instead of piggybacking on int4 aggregates.
      
      initdb forced.
      5f7c2bdb
  29. 13 Aug, 2001 1 commit
  30. 10 Aug, 2001 1 commit
    • Tom Lane's avatar
      Make OIDs optional, per discussions in pghackers. WITH OIDS is still the · bf56f075
      Tom Lane authored
      default, but OIDS are removed from many system catalogs that don't need them.
      Some interesting side effects: TOAST pointers are 20 bytes not 32 now;
      pg_description has a three-column key instead of one.
      
      Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey
      has some usefulness; pg_dump dumps comments on indexes, rules, and
      triggers in a valid order.
      
      initdb forced.
      bf56f075
  31. 15 Jul, 2001 1 commit
    • Tom Lane's avatar
      Restructure index AM interface for index building and index tuple deletion, · c8076f09
      Tom Lane authored
      per previous discussion on pghackers.  Most of the duplicate code in
      different AMs' ambuild routines has been moved out to a common routine
      in index.c; this means that all index types now do the right things about
      inserting recently-dead tuples, etc.  (I also removed support for EXTEND
      INDEX in the ambuild routines, since that's about to go away anyway, and
      it cluttered the code a lot.)  The retail indextuple deletion routines have
      been replaced by a "bulk delete" routine in which the indexscan is inside
      the access method.  I haven't pushed this change as far as it should go yet,
      but it should allow considerable simplification of the internal bookkeeping
      for deletions.  Also, add flag columns to pg_am to eliminate various
      hardcoded tests on AM OIDs, and remove unused pg_am columns.
      
      Fix rtree and gist index types to not attempt to store NULLs; before this,
      gist usually crashed, while rtree managed not to crash but computed wacko
      bounding boxes for NULL entries (which might have had something to do with
      the performance problems we've heard about occasionally).
      
      Add AtEOXact routines to hash, rtree, and gist, all of which have static
      state that needs to be reset after an error.  We discovered this need long
      ago for btree, but missed the other guys.
      
      Oh, one more thing: concurrent VACUUM is now the default.
      c8076f09
  32. 22 Jun, 2001 1 commit
  33. 19 Jun, 2001 1 commit
  34. 16 Jun, 2001 1 commit
    • Tom Lane's avatar
      It turns out that the relcache thinks it can distinguish different · 668db147
      Tom Lane authored
      rules and triggers by OID.  So, even though we have no cross-references
      in the system catalogs to pg_rewrite.oid or pg_trigger.oid, we'd better
      have unique indexes on them.  Put back pg_rewrite_oid_index, which I
      mistakenly removed a few days ago, and add pg_trigger_oid_index.
      668db147
  35. 12 Jun, 2001 1 commit
    • Tom Lane's avatar
      Clean up various to-do items associated with system indexes: · 1d584f97
      Tom Lane authored
      pg_database now has unique indexes on oid and on datname.
      pg_shadow now has unique indexes on usename and on usesysid.
      pg_am now has unique index on oid.
      pg_opclass now has unique index on oid.
      pg_amproc now has unique index on amid+amopclaid+amprocnum.
      Remove pg_rewrite's unnecessary index on oid, delete unused RULEOID syscache.
      Remove index on pg_listener and associated syscache for performance reasons
      (caching rows that are certain to change before you need 'em again is
      rather pointless).
      Change pg_attrdef's nonunique index on adrelid into a unique index on
      adrelid+adnum.
      
      Fix various incorrect settings of pg_class.relisshared, make that the
      primary reference point for whether a relation is shared or not.
      IsSharedSystemRelationName() is now only consulted to initialize relisshared
      during initial creation of tables and indexes.  In theory we might now
      support shared user relations, though it's not clear how one would get
      entries for them into pg_class &etc of multiple databases.
      
      Fix recently reported bug that pg_attribute rows created for an index all have
      the same OID.  (Proof that non-unique OID doesn't matter unless it's
      actually used to do lookups ;-))
      
      There's no need to treat pg_trigger, pg_attrdef, pg_relcheck as bootstrap
      relations.  Convert them into plain system catalogs without hardwired
      entries in pg_class and friends.
      
      Unify global.bki and template1.bki into a single init script postgres.bki,
      since the alleged distinction between them was misleading and pointless.
      Not to mention that it didn't work for setting up indexes on shared
      system relations.
      
      Rationalize locking of pg_shadow, pg_group, pg_attrdef (no need to use
      AccessExclusiveLock where ExclusiveLock or even RowExclusiveLock will do).
      Also, hold locks until transaction commit where necessary.
      1d584f97
  36. 22 May, 2001 1 commit
  37. 21 May, 2001 1 commit
    • Jan Wieck's avatar
      Enhancement of SPI to get access to portals · d27f363e
      Jan Wieck authored
      - New functions to create a portal using a prepared/saved
        SPI plan or lookup an existing portal by name.
      - Functions to fetch/move from/in portals. Results are placed
        in the usual SPI_processed and SPI_tuptable, so the entire
        set of utility functions can be used to gain attribute access.
      - Prepared/saved SPI plans now use their own memory context
        and SPI_freeplan(plan) can remove them.
      - Tuple result sets (SPI_tuptable) now uses it's own memory
        context and can be free'd by SPI_freetuptable(tuptab).
      
      Enhancement of PL/pgSQL
      
      - Uses generic named portals internally in FOR ... SELECT
        loops to avoid running out of memory on huge result sets.
      - Support for CURSOR and REFCURSOR syntax using the new SPI
        functionality. Cursors used internally only need no explicit
        transaction block. Refcursor variables can be used inside
        of explicit transaction block to pass cursors between main
        application and functions.
      
      
      Jan
      d27f363e