/*-------------------------------------------------------------------------
 *
 * planhook.h
 *	  prototypes for plan hooks
 *
 *
 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * $PostgreSQL: pgsql/src/include/optimizer/planhook.h,v 1.48 2008/03/15 20:46:31 tgl Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef PLANHOOK_H
#define PLANHOOK_H

#include "access/htup.h"
#include "nodes/relation.h"
#include "utils/rel.h"

/* Hook for plugins to get control in get_relation_info() */
typedef void (*get_relation_info_hook_type) (PlannerInfo *root,
														 Oid relationObjectId,
														 bool inhparent,
														 RelOptInfo *rel);
extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;

/*
 * The following hooks are called per-attribute in later stages of the
 * planner because this detailed information is not stored in the RelOptInfo 
 * data structure. The APIs emulate stats data access from pg_statistic,
 * rather than attempting a more abstract form.
 */
typedef HeapTuple (*get_relation_stats_hook_type) (Datum relid, Datum attnum);
extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook;

typedef int32 (*get_relation_avg_width_hook_type) (Datum relid, Datum attnum);
extern PGDLLIMPORT get_relation_avg_width_hook_type get_relation_avg_width_hook;

#endif   /* PLANHOOK_H */
