Skip to content

Instantly share code, notes, and snippets.

@ryanmr
Last active December 23, 2015 01:42
Show Gist options
  • Save ryanmr/30af552449d53fc6ff19 to your computer and use it in GitHub Desktop.
Save ryanmr/30af552449d53fc6ff19 to your computer and use it in GitHub Desktop.

Source Modified

Mostly C files

  • backend/executor/Makefile

  • backend/executor/execProcnode.c

  • backend/executor/nodeIgnore.c

  • backend/executor/nodeIgnore.h

  • backend/nodes/copyfuncs.c

  • backend/nodes/equalfuncs.c

  • backend/nodes/outfuncs.c

  • backend/optimizer/plan/createplan.c

  • backend/optimizer/plan/planner.c

  • backend/optimizer/plan/setrefs.c

  • backend/parser/analyze.c

  • backend/parser/gram.y

  • backend/parser/gram.h (this is likely generated from make)

  • backend/parser/parse_clause.c

Header files

  • include/executor/nodeIgnore.h (copied here so the definitons would be available for execnodes.h)

  • include/nodes/execnodes.h

  • include/nodes/nodes.h

  • include/nodes/parsenodes.h

  • include/nodes/plannodes.h

  • include/optimizer/planmain.h

  • include/parser/kwlist.h

  • include/parser/parse_clause.h

git diff --name-only lab4 original

This was used to find this list of changes.

How the code was modified

Briefly:

Most code was heavily adapted from Limit/Offset segments in each file as much as possible. In fact, nodeIgnore.c is almost a direct copy of nodeLimit.c.

  1. The gram.y (which is converted into gram.c with BISON/flex/m4/etc) was given additional constructs for a third type of LIMIT part, the IGNORE. The kwlist.h was updated, and from there, the gram.h files were updated as well.
  2. Getting the data out of the actual query text form is in parse_clause.c with transformIgnoreClause.
  3. The planner.c preprocessor does "something" to the tuples to select them.
  4. It comes together in the nodeIgnore.c where the nodes are individually selected or not.

There were other minute changes (usually adding) parts to switch statements; pretty much where ever there was a direct reference to the LIMIT/OFFSET existing code, some IGNORE code was added locally.

How this IGNORE keyword works:

SELECT * FROM TABLE [WHERE, ORDERBY] IGNORE ;

You cannot, for example, combine IGNORE with LIMIT or OFFSET.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment