You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
We do not support specifying nulls {first | last} yet. When nothing is specified, the default behavior of PostgreSQL is to treat nulls as larger than non-nulls (i.e. nulls last for asc and nulls first for desc).
But in our current implementation, memcomparable encodes nulls as smaller than non-nulls. And parts not using memcomparable are implemented to keep consistent with it rather than PostgreSQL.
To Reproduce
create table t (v1 int);
insert into t values (2), (null), (3), (1);
select * from t order by v1;
select * from t order by v1 desc;
select * from t order by v1 limit 2;
select * from t order by v1 desc limit 2;
create materialized view mv_a as select * from t order by v1;
create materialized view mv_d as select * from t order by v1 desc;
create materialized view mv_a2 as select * from t order by v1 limit 2;
create materialized view mv_d2 as select * from t order by v1 desc limit 2;
select * from mv_a;
select * from mv_d;
select * from mv_a2;
select * from mv_d2;
Expected behavior
Same behavior as PostgreSQL.
Additional context
Do not see an immediate need to fix it (before fully supporting nulls {first | last}). Just documenting the current behavior. And we should fix the default behavior when we implement nulls {first | last}.
The text was updated successfully, but these errors were encountered:
Describe the bug
We do not support specifying
nulls {first | last}
yet. When nothing is specified, the default behavior of PostgreSQL is to treat nulls as larger than non-nulls (i.e.nulls last
forasc
andnulls first
fordesc
).But in our current implementation, memcomparable encodes nulls as smaller than non-nulls. And parts not using memcomparable are implemented to keep consistent with it rather than PostgreSQL.
To Reproduce
Expected behavior
Same behavior as PostgreSQL.
Additional context
Do not see an immediate need to fix it (before fully supporting
nulls {first | last}
). Just documenting the current behavior. And we should fix the default behavior when we implementnulls {first | last}
.The text was updated successfully, but these errors were encountered: