-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
138 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "pgduckdb/pg/declarations.hpp" | ||
|
||
namespace pgduckdb { | ||
|
||
// FIXME - this is a macro in Postgres, would be great to inline it to avoid the overhead of a function call | ||
TupleDesc PDRelationGetDescr(Relation relation); | ||
|
||
Relation RelationIdGetRelation(Oid relationId); | ||
|
||
void RelationClose(Relation relation); | ||
|
||
int GetTupleDescNatts(const TupleDesc tupleDesc); | ||
|
||
const char *GetAttName(const Form_pg_attribute); | ||
|
||
Form_pg_attribute GetAttr(const TupleDesc tupleDesc, int i); | ||
|
||
void EstimateRelSize(Relation rel, int32_t *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
extern "C" { | ||
extern Snapshot GetActiveSnapshot(void); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#include "pgduckdb/pg_declarations.hpp" | ||
#include "pgduckdb/pg/declarations.hpp" | ||
|
||
void DuckdbHandleDDL(Node *ParseTree, const char *queryString); | ||
void DuckdbTruncateTable(Oid relation_oid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "pgduckdb/pg/relations.hpp" | ||
|
||
extern "C" { | ||
#include "postgres.h" | ||
#include "utils/rel.h" | ||
#include "optimizer/plancat.h" // estimate_rel_size | ||
} | ||
|
||
namespace pgduckdb { | ||
|
||
TupleDesc PDRelationGetDescr(Relation relation) { | ||
return relation->rd_att; | ||
} | ||
|
||
int GetTupleDescNatts(const TupleDesc tupleDesc) { | ||
return tupleDesc->natts; | ||
} | ||
|
||
const char *GetAttName(const Form_pg_attribute att) { | ||
return NameStr(att->attname); | ||
} | ||
|
||
Form_pg_attribute GetAttr(const TupleDesc tupleDesc, int i) { | ||
return &tupleDesc->attrs[i]; | ||
} | ||
|
||
Relation RelationIdGetRelation(Oid relationId) { | ||
return ::RelationIdGetRelation(relationId); | ||
} | ||
|
||
void RelationClose(Relation relation) { | ||
::RelationClose(relation); | ||
} | ||
|
||
void EstimateRelSize(Relation rel, int32_t *attr_widths, BlockNumber *pages, double *tuples, double *allvisfrac) { | ||
::estimate_rel_size(rel, attr_widths, pages, tuples, allvisfrac); | ||
} | ||
|
||
} // namespace pgduckdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters