Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

DuplicateAliasInSubqueryError.md

226 lines4.8 KB

1---
2id: DuplicateAliasInSubqueryError
3title: DuplicateAliasInSubqueryError
4---
5​
6Defined in: [packages/db/src/errors.ts:601](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L601)
7​
8Error thrown when a subquery uses the same alias as its parent query.
9This causes issues because parent and subquery would share the same input streams,
10leading to empty results or incorrect data (aggregation cross-leaking).
11​
12## Extends
13​
14- [`QueryCompilationError`](QueryCompilationError.md)
15​
16## Constructors
17​
18### Constructor
19​
20```ts
21new DuplicateAliasInSubqueryError(alias, parentAliases): DuplicateAliasInSubqueryError;
22```
23​
24Defined in: [packages/db/src/errors.ts:602](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L602)
25​
26#### Parameters
27​
28##### alias
29​
30`string`
31​
32##### parentAliases
33​
34`string`[]
35​
36#### Returns
37​
38`DuplicateAliasInSubqueryError`
39​
40#### Overrides
41​
42[`QueryCompilationError`](QueryCompilationError.md).[`constructor`](QueryCompilationError.md#constructor)
43​
44## Properties
45​
46### cause?
47​
48```ts
49optional cause: unknown;
50```
51​
52Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
53​
54#### Inherited from
55​
56[`QueryCompilationError`](QueryCompilationError.md).[`cause`](QueryCompilationError.md#cause)
57​
58***
59​
60### message
61​
62```ts
63message: string;
64```
65​
66Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077
67​
68#### Inherited from
69​
70[`QueryCompilationError`](QueryCompilationError.md).[`message`](QueryCompilationError.md#message)
71​
72***
73​
74### name
75​
76```ts
77name: string;
78```
79​
80Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
81​
82#### Inherited from
83​
84[`QueryCompilationError`](QueryCompilationError.md).[`name`](QueryCompilationError.md#name)
85​
86***
87​
88### stack?
89​
90```ts
91optional stack: string;
92```
93​
94Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
95​
96#### Inherited from
97​
98[`QueryCompilationError`](QueryCompilationError.md).[`stack`](QueryCompilationError.md#stack)
99​
100***
101​
102### stackTraceLimit
103​
104```ts
105static stackTraceLimit: number;
106```
107​
108Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67
109​
110The `Error.stackTraceLimit` property specifies the number of stack frames
111collected by a stack trace (whether generated by `new Error().stack` or
112`Error.captureStackTrace(obj)`).
113​
114The default value is `10` but may be set to any valid JavaScript number. Changes
115will affect any stack trace captured _after_ the value has been changed.
116​
117If set to a non-number value, or set to a negative number, stack traces will
118not capture any frames.
119​
120#### Inherited from
121​
122[`QueryCompilationError`](QueryCompilationError.md).[`stackTraceLimit`](QueryCompilationError.md#stacktracelimit)
123​
124## Methods
125​
126### captureStackTrace()
127​
128```ts
129static captureStackTrace(targetObject, constructorOpt?): void;
130```
131​
132Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:51
133​
134Creates a `.stack` property on `targetObject`, which when accessed returns
135a string representing the location in the code at which
136`Error.captureStackTrace()` was called.
137​
138```js
139const myObject = {};
140Error.captureStackTrace(myObject);
141myObject.stack; // Similar to `new Error().stack`
142```
143​
144The first line of the trace will be prefixed with
145`${myObject.name}: ${myObject.message}`.
146​
147The optional `constructorOpt` argument accepts a function. If given, all frames
148above `constructorOpt`, including `constructorOpt`, will be omitted from the
149generated stack trace.
150​
151The `constructorOpt` argument is useful for hiding implementation
152details of error generation from the user. For instance:
153​
154```js
155function a() {
156 b();
158​
159function b() {
160 c();
162​
163function c() {
164 // Create an error without stack trace to avoid calculating the stack trace twice.
165 const { stackTraceLimit } = Error;
166 Error.stackTraceLimit = 0;
167 const error = new Error();
168 Error.stackTraceLimit = stackTraceLimit;
169​
170 // Capture the stack trace above function b
171 Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
172 throw error;
174​
175a();
176```
177​
178#### Parameters
179​
180##### targetObject
181​
182`object`
183​
184##### constructorOpt?
185​
186`Function`
187​
188#### Returns
189​
190`void`
191​
192#### Inherited from
193​
194[`QueryCompilationError`](QueryCompilationError.md).[`captureStackTrace`](QueryCompilationError.md#capturestacktrace)
195​
196***
197​
198### prepareStackTrace()
199​
200```ts
201static prepareStackTrace(err, stackTraces): any;
202```
203​
204Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55
205​
206#### Parameters
207​
208##### err
209​
210`Error`
211​
212##### stackTraces
213​
214`CallSite`[]
215​
216#### Returns
217​
218`any`
219​
220#### See
221​
222https://v8.dev/docs/stack-trace-api#customizing-stack-traces
223​
224#### Inherited from
225​
226[`QueryCompilationError`](QueryCompilationError.md).[`prepareStackTrace`](QueryCompilationError.md#preparestacktrace)