Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Update with getting type error Aliased is not assigned to type #3987

Open
1 task done
xkalf opened this issue Jan 23, 2025 · 0 comments
Open
1 task done

[BUG]: Update with getting type error Aliased is not assigned to type #3987

xkalf opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@xkalf
Copy link

xkalf commented Jan 23, 2025

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.37.0

What version of drizzle-kit are you using?

0.29.1

Other packages

No response

Describe the Bug

        const rankedAverage = db.$with('ranked_average').as(
          db
            .select({
              id: rankAverage.id,
              value: rankAverage.value,
              allRank:
                sql<number>`row_number() over (partition by ${rankAverage.cubeTypeId}, order by ${rankAverage.value})`.as(
                  'c_all_rank',
                ),
              provinceRank:
                sql<number>`row_number() over (partition by ${rankAverage.cubeTypeId}, ${rankAverage.provinceId}, order by ${rankAverage.value})`.as(
                  'c_province_rank',
                ),
              districtRank:
                sql<number>`row_number() over (partition by ${rankAverage.cubeTypeId}, ${rankAverage.districtId}, order by ${rankAverage.value})`.as(
                  'c_district_rank',
                ),
            })
            .from(rankAverage),
        )

        await db
          .with(rankedAverage)
          .update(rankAverage)
          .set({
            allRank: rankedAverage.allRank,
          }).from(rankedAverage)

in this query im getting error
│ Type 'Aliased' is missing the following properties from type 'PgColumn<ColumnBaseConfig<ColumnDataType, string>, {}, {}>': table, name, keyAsName, primary, and 17 more. ts (2322) [352, 13]

@xkalf xkalf added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant