duckdb 0.3.5-dev1357.0 → 0.3.5-dev1364.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb.cpp +246 -30
- package/src/duckdb.hpp +4 -2
- package/src/parquet-amalgamation.cpp +36870 -36870
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -7663,6 +7663,18 @@ string StatementTypeToString(StatementType type) {
|
|
|
7663
7663
|
}
|
|
7664
7664
|
return "INVALID";
|
|
7665
7665
|
}
|
|
7666
|
+
|
|
7667
|
+
string StatementReturnTypeToString(StatementReturnType type) {
|
|
7668
|
+
switch (type) {
|
|
7669
|
+
case StatementReturnType::QUERY_RESULT:
|
|
7670
|
+
return "QUERY_RESULT";
|
|
7671
|
+
case StatementReturnType::CHANGED_ROWS:
|
|
7672
|
+
return "CHANGED_ROWS";
|
|
7673
|
+
case StatementReturnType::NOTHING:
|
|
7674
|
+
return "NOTHING";
|
|
7675
|
+
}
|
|
7676
|
+
return "INVALID";
|
|
7677
|
+
}
|
|
7666
7678
|
// LCOV_EXCL_STOP
|
|
7667
7679
|
|
|
7668
7680
|
} // namespace duckdb
|
|
@@ -91573,6 +91585,7 @@ void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
91573
91585
|
|
|
91574
91586
|
|
|
91575
91587
|
|
|
91588
|
+
|
|
91576
91589
|
namespace duckdb {
|
|
91577
91590
|
|
|
91578
91591
|
struct DateTrunc {
|
|
@@ -91590,32 +91603,28 @@ struct DateTrunc {
|
|
|
91590
91603
|
struct MillenniumOperator {
|
|
91591
91604
|
template <class TA, class TR>
|
|
91592
91605
|
static inline TR Operation(TA input) {
|
|
91593
|
-
|
|
91594
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 1000) * 1000, 1, 1), dtime_t(0));
|
|
91606
|
+
return Date::FromDate((Date::ExtractYear(input) / 1000) * 1000, 1, 1);
|
|
91595
91607
|
}
|
|
91596
91608
|
};
|
|
91597
91609
|
|
|
91598
91610
|
struct CenturyOperator {
|
|
91599
91611
|
template <class TA, class TR>
|
|
91600
91612
|
static inline TR Operation(TA input) {
|
|
91601
|
-
|
|
91602
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 100) * 100, 1, 1), dtime_t(0));
|
|
91613
|
+
return Date::FromDate((Date::ExtractYear(input) / 100) * 100, 1, 1);
|
|
91603
91614
|
}
|
|
91604
91615
|
};
|
|
91605
91616
|
|
|
91606
91617
|
struct DecadeOperator {
|
|
91607
91618
|
template <class TA, class TR>
|
|
91608
91619
|
static inline TR Operation(TA input) {
|
|
91609
|
-
|
|
91610
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 10) * 10, 1, 1), dtime_t(0));
|
|
91620
|
+
return Date::FromDate((Date::ExtractYear(input) / 10) * 10, 1, 1);
|
|
91611
91621
|
}
|
|
91612
91622
|
};
|
|
91613
91623
|
|
|
91614
91624
|
struct YearOperator {
|
|
91615
91625
|
template <class TA, class TR>
|
|
91616
91626
|
static inline TR Operation(TA input) {
|
|
91617
|
-
|
|
91618
|
-
return Timestamp::FromDatetime(Date::FromDate(Date::ExtractYear(date), 1, 1), dtime_t(0));
|
|
91627
|
+
return Date::FromDate(Date::ExtractYear(input), 1, 1);
|
|
91619
91628
|
}
|
|
91620
91629
|
};
|
|
91621
91630
|
|
|
@@ -91623,27 +91632,23 @@ struct DateTrunc {
|
|
|
91623
91632
|
template <class TA, class TR>
|
|
91624
91633
|
static inline TR Operation(TA input) {
|
|
91625
91634
|
int32_t yyyy, mm, dd;
|
|
91626
|
-
Date::Convert(
|
|
91635
|
+
Date::Convert(input, yyyy, mm, dd);
|
|
91627
91636
|
mm = 1 + (((mm - 1) / 3) * 3);
|
|
91628
|
-
return
|
|
91637
|
+
return Date::FromDate(yyyy, mm, 1);
|
|
91629
91638
|
}
|
|
91630
91639
|
};
|
|
91631
91640
|
|
|
91632
91641
|
struct MonthOperator {
|
|
91633
91642
|
template <class TA, class TR>
|
|
91634
91643
|
static inline TR Operation(TA input) {
|
|
91635
|
-
|
|
91636
|
-
return Timestamp::FromDatetime(Date::FromDate(Date::ExtractYear(date), Date::ExtractMonth(date), 1),
|
|
91637
|
-
dtime_t(0));
|
|
91644
|
+
return Date::FromDate(Date::ExtractYear(input), Date::ExtractMonth(input), 1);
|
|
91638
91645
|
}
|
|
91639
91646
|
};
|
|
91640
91647
|
|
|
91641
91648
|
struct WeekOperator {
|
|
91642
91649
|
template <class TA, class TR>
|
|
91643
91650
|
static inline TR Operation(TA input) {
|
|
91644
|
-
|
|
91645
|
-
|
|
91646
|
-
return Timestamp::FromDatetime(Date::GetMondayOfCurrentWeek(date), dtime_t(0));
|
|
91651
|
+
return Date::GetMondayOfCurrentWeek(input);
|
|
91647
91652
|
}
|
|
91648
91653
|
};
|
|
91649
91654
|
|
|
@@ -91653,15 +91658,14 @@ struct DateTrunc {
|
|
|
91653
91658
|
date_t date = Date::GetMondayOfCurrentWeek(input);
|
|
91654
91659
|
date.days -= (Date::ExtractISOWeekNumber(date) - 1) * Interval::DAYS_PER_WEEK;
|
|
91655
91660
|
|
|
91656
|
-
return
|
|
91661
|
+
return date;
|
|
91657
91662
|
}
|
|
91658
91663
|
};
|
|
91659
91664
|
|
|
91660
91665
|
struct DayOperator {
|
|
91661
91666
|
template <class TA, class TR>
|
|
91662
91667
|
static inline TR Operation(TA input) {
|
|
91663
|
-
|
|
91664
|
-
return Timestamp::FromDatetime(date, dtime_t(0));
|
|
91668
|
+
return input;
|
|
91665
91669
|
}
|
|
91666
91670
|
};
|
|
91667
91671
|
|
|
@@ -91723,39 +91727,119 @@ struct DateTrunc {
|
|
|
91723
91727
|
};
|
|
91724
91728
|
|
|
91725
91729
|
// DATE specialisations
|
|
91730
|
+
template <>
|
|
91731
|
+
date_t DateTrunc::MillenniumOperator::Operation(timestamp_t input) {
|
|
91732
|
+
return MillenniumOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91733
|
+
}
|
|
91734
|
+
|
|
91726
91735
|
template <>
|
|
91727
91736
|
timestamp_t DateTrunc::MillenniumOperator::Operation(date_t input) {
|
|
91728
|
-
return MillenniumOperator::Operation<
|
|
91737
|
+
return Timestamp::FromDatetime(MillenniumOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91738
|
+
}
|
|
91739
|
+
|
|
91740
|
+
template <>
|
|
91741
|
+
timestamp_t DateTrunc::MillenniumOperator::Operation(timestamp_t input) {
|
|
91742
|
+
return MillenniumOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91743
|
+
}
|
|
91744
|
+
|
|
91745
|
+
template <>
|
|
91746
|
+
date_t DateTrunc::CenturyOperator::Operation(timestamp_t input) {
|
|
91747
|
+
return CenturyOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91729
91748
|
}
|
|
91730
91749
|
|
|
91731
91750
|
template <>
|
|
91732
91751
|
timestamp_t DateTrunc::CenturyOperator::Operation(date_t input) {
|
|
91733
|
-
return CenturyOperator::Operation<
|
|
91752
|
+
return Timestamp::FromDatetime(CenturyOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91753
|
+
}
|
|
91754
|
+
|
|
91755
|
+
template <>
|
|
91756
|
+
timestamp_t DateTrunc::CenturyOperator::Operation(timestamp_t input) {
|
|
91757
|
+
return CenturyOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91758
|
+
}
|
|
91759
|
+
|
|
91760
|
+
template <>
|
|
91761
|
+
date_t DateTrunc::DecadeOperator::Operation(timestamp_t input) {
|
|
91762
|
+
return DecadeOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91734
91763
|
}
|
|
91735
91764
|
|
|
91736
91765
|
template <>
|
|
91737
91766
|
timestamp_t DateTrunc::DecadeOperator::Operation(date_t input) {
|
|
91738
|
-
return DecadeOperator::Operation<
|
|
91767
|
+
return Timestamp::FromDatetime(DecadeOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91768
|
+
}
|
|
91769
|
+
|
|
91770
|
+
template <>
|
|
91771
|
+
timestamp_t DateTrunc::DecadeOperator::Operation(timestamp_t input) {
|
|
91772
|
+
return DecadeOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91773
|
+
}
|
|
91774
|
+
|
|
91775
|
+
template <>
|
|
91776
|
+
date_t DateTrunc::YearOperator::Operation(timestamp_t input) {
|
|
91777
|
+
return YearOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91739
91778
|
}
|
|
91740
91779
|
|
|
91741
91780
|
template <>
|
|
91742
91781
|
timestamp_t DateTrunc::YearOperator::Operation(date_t input) {
|
|
91743
|
-
return YearOperator::Operation<
|
|
91782
|
+
return Timestamp::FromDatetime(YearOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91783
|
+
}
|
|
91784
|
+
|
|
91785
|
+
template <>
|
|
91786
|
+
timestamp_t DateTrunc::YearOperator::Operation(timestamp_t input) {
|
|
91787
|
+
return YearOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91788
|
+
}
|
|
91789
|
+
|
|
91790
|
+
template <>
|
|
91791
|
+
date_t DateTrunc::QuarterOperator::Operation(timestamp_t input) {
|
|
91792
|
+
return QuarterOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91744
91793
|
}
|
|
91745
91794
|
|
|
91746
91795
|
template <>
|
|
91747
91796
|
timestamp_t DateTrunc::QuarterOperator::Operation(date_t input) {
|
|
91748
|
-
return QuarterOperator::Operation<
|
|
91797
|
+
return Timestamp::FromDatetime(QuarterOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91798
|
+
}
|
|
91799
|
+
|
|
91800
|
+
template <>
|
|
91801
|
+
timestamp_t DateTrunc::QuarterOperator::Operation(timestamp_t input) {
|
|
91802
|
+
return QuarterOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91803
|
+
}
|
|
91804
|
+
|
|
91805
|
+
template <>
|
|
91806
|
+
date_t DateTrunc::MonthOperator::Operation(timestamp_t input) {
|
|
91807
|
+
return MonthOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91749
91808
|
}
|
|
91750
91809
|
|
|
91751
91810
|
template <>
|
|
91752
91811
|
timestamp_t DateTrunc::MonthOperator::Operation(date_t input) {
|
|
91753
|
-
return MonthOperator::Operation<
|
|
91812
|
+
return Timestamp::FromDatetime(MonthOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91813
|
+
}
|
|
91814
|
+
|
|
91815
|
+
template <>
|
|
91816
|
+
timestamp_t DateTrunc::MonthOperator::Operation(timestamp_t input) {
|
|
91817
|
+
return MonthOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91818
|
+
}
|
|
91819
|
+
|
|
91820
|
+
template <>
|
|
91821
|
+
date_t DateTrunc::WeekOperator::Operation(timestamp_t input) {
|
|
91822
|
+
return WeekOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91754
91823
|
}
|
|
91755
91824
|
|
|
91756
91825
|
template <>
|
|
91757
91826
|
timestamp_t DateTrunc::WeekOperator::Operation(date_t input) {
|
|
91758
|
-
return WeekOperator::Operation<
|
|
91827
|
+
return Timestamp::FromDatetime(WeekOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91828
|
+
}
|
|
91829
|
+
|
|
91830
|
+
template <>
|
|
91831
|
+
timestamp_t DateTrunc::WeekOperator::Operation(timestamp_t input) {
|
|
91832
|
+
return WeekOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91833
|
+
}
|
|
91834
|
+
|
|
91835
|
+
template <>
|
|
91836
|
+
date_t DateTrunc::ISOYearOperator::Operation(timestamp_t input) {
|
|
91837
|
+
return ISOYearOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91838
|
+
}
|
|
91839
|
+
|
|
91840
|
+
template <>
|
|
91841
|
+
timestamp_t DateTrunc::ISOYearOperator::Operation(date_t input) {
|
|
91842
|
+
return Timestamp::FromDatetime(ISOYearOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91759
91843
|
}
|
|
91760
91844
|
|
|
91761
91845
|
template <>
|
|
@@ -91763,9 +91847,24 @@ timestamp_t DateTrunc::ISOYearOperator::Operation(timestamp_t input) {
|
|
|
91763
91847
|
return ISOYearOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91764
91848
|
}
|
|
91765
91849
|
|
|
91850
|
+
template <>
|
|
91851
|
+
date_t DateTrunc::DayOperator::Operation(timestamp_t input) {
|
|
91852
|
+
return DayOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91853
|
+
}
|
|
91854
|
+
|
|
91766
91855
|
template <>
|
|
91767
91856
|
timestamp_t DateTrunc::DayOperator::Operation(date_t input) {
|
|
91768
|
-
return Timestamp::FromDatetime(input, dtime_t(0));
|
|
91857
|
+
return Timestamp::FromDatetime(DayOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91858
|
+
}
|
|
91859
|
+
|
|
91860
|
+
template <>
|
|
91861
|
+
timestamp_t DateTrunc::DayOperator::Operation(timestamp_t input) {
|
|
91862
|
+
return DayOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91863
|
+
}
|
|
91864
|
+
|
|
91865
|
+
template <>
|
|
91866
|
+
date_t DateTrunc::HourOperator::Operation(date_t input) {
|
|
91867
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91769
91868
|
}
|
|
91770
91869
|
|
|
91771
91870
|
template <>
|
|
@@ -91773,26 +91872,71 @@ timestamp_t DateTrunc::HourOperator::Operation(date_t input) {
|
|
|
91773
91872
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91774
91873
|
}
|
|
91775
91874
|
|
|
91875
|
+
template <>
|
|
91876
|
+
date_t DateTrunc::HourOperator::Operation(timestamp_t input) {
|
|
91877
|
+
return Timestamp::GetDate(HourOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91878
|
+
}
|
|
91879
|
+
|
|
91880
|
+
template <>
|
|
91881
|
+
date_t DateTrunc::MinuteOperator::Operation(date_t input) {
|
|
91882
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91883
|
+
}
|
|
91884
|
+
|
|
91776
91885
|
template <>
|
|
91777
91886
|
timestamp_t DateTrunc::MinuteOperator::Operation(date_t input) {
|
|
91778
91887
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91779
91888
|
}
|
|
91780
91889
|
|
|
91890
|
+
template <>
|
|
91891
|
+
date_t DateTrunc::MinuteOperator::Operation(timestamp_t input) {
|
|
91892
|
+
return Timestamp::GetDate(HourOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91893
|
+
}
|
|
91894
|
+
|
|
91895
|
+
template <>
|
|
91896
|
+
date_t DateTrunc::SecondOperator::Operation(date_t input) {
|
|
91897
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91898
|
+
}
|
|
91899
|
+
|
|
91781
91900
|
template <>
|
|
91782
91901
|
timestamp_t DateTrunc::SecondOperator::Operation(date_t input) {
|
|
91783
91902
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91784
91903
|
}
|
|
91785
91904
|
|
|
91905
|
+
template <>
|
|
91906
|
+
date_t DateTrunc::SecondOperator::Operation(timestamp_t input) {
|
|
91907
|
+
return Timestamp::GetDate(DayOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91908
|
+
}
|
|
91909
|
+
|
|
91910
|
+
template <>
|
|
91911
|
+
date_t DateTrunc::MillisecondOperator::Operation(date_t input) {
|
|
91912
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91913
|
+
}
|
|
91914
|
+
|
|
91786
91915
|
template <>
|
|
91787
91916
|
timestamp_t DateTrunc::MillisecondOperator::Operation(date_t input) {
|
|
91788
91917
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91789
91918
|
}
|
|
91790
91919
|
|
|
91920
|
+
template <>
|
|
91921
|
+
date_t DateTrunc::MillisecondOperator::Operation(timestamp_t input) {
|
|
91922
|
+
return Timestamp::GetDate(MillisecondOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91923
|
+
}
|
|
91924
|
+
|
|
91925
|
+
template <>
|
|
91926
|
+
date_t DateTrunc::MicrosecondOperator::Operation(date_t input) {
|
|
91927
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91928
|
+
}
|
|
91929
|
+
|
|
91791
91930
|
template <>
|
|
91792
91931
|
timestamp_t DateTrunc::MicrosecondOperator::Operation(date_t input) {
|
|
91793
91932
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91794
91933
|
}
|
|
91795
91934
|
|
|
91935
|
+
template <>
|
|
91936
|
+
date_t DateTrunc::MicrosecondOperator::Operation(timestamp_t input) {
|
|
91937
|
+
return Timestamp::GetDate(MicrosecondOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91938
|
+
}
|
|
91939
|
+
|
|
91796
91940
|
// INTERVAL specialisations
|
|
91797
91941
|
template <>
|
|
91798
91942
|
interval_t DateTrunc::MillenniumOperator::Operation(interval_t input) {
|
|
@@ -92016,12 +92160,58 @@ static void DateTruncFunction(DataChunk &args, ExpressionState &state, Vector &r
|
|
|
92016
92160
|
}
|
|
92017
92161
|
}
|
|
92018
92162
|
|
|
92163
|
+
static unique_ptr<FunctionData> DateTruncBind(ClientContext &context, ScalarFunction &bound_function,
|
|
92164
|
+
vector<unique_ptr<Expression>> &arguments) {
|
|
92165
|
+
if (!arguments[0]->IsFoldable()) {
|
|
92166
|
+
return nullptr;
|
|
92167
|
+
}
|
|
92168
|
+
|
|
92169
|
+
// Rebind to return a date if we are truncating that far
|
|
92170
|
+
Value part_value = ExpressionExecutor::EvaluateScalar(*arguments[0]);
|
|
92171
|
+
if (part_value.IsNull()) {
|
|
92172
|
+
return nullptr;
|
|
92173
|
+
}
|
|
92174
|
+
const auto part_name = part_value.ToString();
|
|
92175
|
+
const auto part_code = GetDatePartSpecifier(part_name);
|
|
92176
|
+
switch (part_code) {
|
|
92177
|
+
case DatePartSpecifier::MILLENNIUM:
|
|
92178
|
+
case DatePartSpecifier::CENTURY:
|
|
92179
|
+
case DatePartSpecifier::DECADE:
|
|
92180
|
+
case DatePartSpecifier::YEAR:
|
|
92181
|
+
case DatePartSpecifier::QUARTER:
|
|
92182
|
+
case DatePartSpecifier::MONTH:
|
|
92183
|
+
case DatePartSpecifier::WEEK:
|
|
92184
|
+
case DatePartSpecifier::YEARWEEK:
|
|
92185
|
+
case DatePartSpecifier::ISOYEAR:
|
|
92186
|
+
case DatePartSpecifier::DAY:
|
|
92187
|
+
case DatePartSpecifier::DOW:
|
|
92188
|
+
case DatePartSpecifier::ISODOW:
|
|
92189
|
+
case DatePartSpecifier::DOY:
|
|
92190
|
+
switch (arguments[1]->return_type.id()) {
|
|
92191
|
+
case LogicalType::TIMESTAMP:
|
|
92192
|
+
bound_function.function = DateTruncFunction<timestamp_t, date_t>;
|
|
92193
|
+
break;
|
|
92194
|
+
case LogicalType::DATE:
|
|
92195
|
+
bound_function.function = DateTruncFunction<date_t, date_t>;
|
|
92196
|
+
break;
|
|
92197
|
+
default:
|
|
92198
|
+
break;
|
|
92199
|
+
}
|
|
92200
|
+
bound_function.return_type = LogicalType::DATE;
|
|
92201
|
+
break;
|
|
92202
|
+
default:
|
|
92203
|
+
break;
|
|
92204
|
+
}
|
|
92205
|
+
|
|
92206
|
+
return nullptr;
|
|
92207
|
+
}
|
|
92208
|
+
|
|
92019
92209
|
void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
|
|
92020
92210
|
ScalarFunctionSet date_trunc("date_trunc");
|
|
92021
92211
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
|
|
92022
|
-
DateTruncFunction<timestamp_t, timestamp_t
|
|
92212
|
+
DateTruncFunction<timestamp_t, timestamp_t>, false, false, DateTruncBind));
|
|
92023
92213
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::TIMESTAMP,
|
|
92024
|
-
DateTruncFunction<date_t, timestamp_t
|
|
92214
|
+
DateTruncFunction<date_t, timestamp_t>, false, false, DateTruncBind));
|
|
92025
92215
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::INTERVAL}, LogicalType::INTERVAL,
|
|
92026
92216
|
DateTruncFunction<interval_t, interval_t>));
|
|
92027
92217
|
set.AddFunction(date_trunc);
|
|
@@ -156969,7 +157159,28 @@ unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGLis
|
|
|
156969
157159
|
"dictionary, pfor, bitpacking or fsst");
|
|
156970
157160
|
}
|
|
156971
157161
|
return nullptr;
|
|
156972
|
-
case duckdb_libpgquery::PG_CONSTR_FOREIGN:
|
|
157162
|
+
case duckdb_libpgquery::PG_CONSTR_FOREIGN: {
|
|
157163
|
+
ForeignKeyInfo fk_info;
|
|
157164
|
+
fk_info.type = ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE;
|
|
157165
|
+
if (constraint->pktable->schemaname) {
|
|
157166
|
+
fk_info.schema = constraint->pktable->schemaname;
|
|
157167
|
+
} else {
|
|
157168
|
+
fk_info.schema = "";
|
|
157169
|
+
}
|
|
157170
|
+
fk_info.table = constraint->pktable->relname;
|
|
157171
|
+
vector<string> pk_columns, fk_columns;
|
|
157172
|
+
|
|
157173
|
+
fk_columns.emplace_back(column.Name().c_str());
|
|
157174
|
+
if (constraint->pk_attrs) {
|
|
157175
|
+
for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) {
|
|
157176
|
+
pk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
|
157177
|
+
}
|
|
157178
|
+
}
|
|
157179
|
+
if (pk_columns.size() != fk_columns.size()) {
|
|
157180
|
+
throw ParserException("The number of referencing and referenced columns for foreign keys must be the same");
|
|
157181
|
+
}
|
|
157182
|
+
return make_unique<ForeignKeyConstraint>(pk_columns, fk_columns, move(fk_info));
|
|
157183
|
+
}
|
|
156973
157184
|
default:
|
|
156974
157185
|
throw NotImplementedException("Constraint not implemented!");
|
|
156975
157186
|
}
|
|
@@ -160280,6 +160491,11 @@ unique_ptr<CreateStatement> Transformer::TransformCreateTable(duckdb_libpgquery:
|
|
|
160280
160491
|
throw NotImplementedException("ColumnDef type not handled yet");
|
|
160281
160492
|
}
|
|
160282
160493
|
}
|
|
160494
|
+
|
|
160495
|
+
if (!column_count) {
|
|
160496
|
+
throw ParserException("Table must have at least one column!");
|
|
160497
|
+
}
|
|
160498
|
+
|
|
160283
160499
|
result->info = move(info);
|
|
160284
160500
|
return result;
|
|
160285
160501
|
}
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.3.5-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "aa105267d"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev1364"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -9897,6 +9897,8 @@ enum class StatementReturnType : uint8_t {
|
|
|
9897
9897
|
NOTHING // the statement returns nothing
|
|
9898
9898
|
};
|
|
9899
9899
|
|
|
9900
|
+
string StatementReturnTypeToString(StatementReturnType type);
|
|
9901
|
+
|
|
9900
9902
|
//! A struct containing various properties of a SQL statement
|
|
9901
9903
|
struct StatementProperties {
|
|
9902
9904
|
StatementProperties()
|