Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(introspection): corrected bitmasks for mutability checks #508

Merged
merged 1 commit into from
Aug 23, 2019
Merged

fix(introspection): corrected bitmasks for mutability checks #508

merged 1 commit into from
Aug 23, 2019

Conversation

rudism
Copy link
Contributor

@rudism rudism commented Aug 22, 2019

@benjie
Copy link
Member

benjie commented Aug 23, 2019

Great spot; our logic is the wrong way around.

CMD_UPDATE (2), CMD_INSERT (3) and CMD_DELETE (4) are defined here:

typedef enum CmdType
{
	CMD_UNKNOWN,
	CMD_SELECT,					/* select stmt */
	CMD_UPDATE,					/* update stmt */
	CMD_INSERT,					/* insert stmt */
	CMD_DELETE,
	CMD_UTILITY,				/* cmds like create, destroy, copy, vacuum,
								 * etc. */
	CMD_NOTHING					/* dummy command for instead nothing rules
								 * with qual */
} CmdType;

That's used here to build the bitmap:

			if (trigDesc->trig_insert_instead_row)
				events |= (1 << CMD_INSERT);
			if (trigDesc->trig_update_instead_row)
				events |= (1 << CMD_UPDATE);
			if (trigDesc->trig_delete_instead_row)
				events |= (1 << CMD_DELETE);

So I can confirm that INSERT is the 4th bit (00001000), UPDATE is the 3rd bit (00000100), and DELETE is the 5th bit (00010000).

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug literally just passed 3 years old, and you had the audacity to squash it?! 😂

graphile/crystal@14f5db7

@benjie benjie merged commit 5fae076 into graphile:master Aug 23, 2019
none23 pushed a commit to none23/graphile-engine that referenced this pull request Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange CRUD mutation behavior on views with triggers
2 participants