Hi: I have a problem with printing expression. For a course project, I'm changing postgres optimizer. My problem is that at some point, I need to print the restrict caluses of a sequential scan. I get the list of restrict clauses and for each RestructInfo, I call print_expr(Node *expr, List *rtable) [defined in print.c] as follows: .... RestrictInfo *c = lfirst(l); print_expr((Node *) c->clause, root->rtable); The code works well for all clauses except for the ones that deal with a char column (e.g., SELECT .... WHERE name = 'abc'). For the latter type of clauses, the printed string is something like "unknown expr = 'abc'" In other words, the column name is not printed correctly. I traced the code and it seems that the problem is that for a clause on a non-string column, the cluase is represented by 3 nodes of the followiing types T_OpExpr, T_Var, T_Const (e.g: =,part_id,2) But for clauses on string columns, the caluse is stored as 3 nodes of these types: T_RelabelType, T_Var, T_Const print_expr() does not knwo how to deal with T_RelabelType, nodes. Does anyone know why string columns are represented differently and how can I make print_expr() work? Is there another easier way to print restrict clauses? (Note that I don't want ot call explain or similar commands to print everything for me. I need to be able to print single restrict caluses given the Path, RelOptInfo, and Query structs). Thanks a lot, Hossein Attar __________________________________________________________ Find your next car at http://autos.yahoo.ca