FromSql results in error, while query is working in pgAdmin The 2019 Stack Overflow Developer Survey Results Are InConvert Linq Query Result to DictionaryGetting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with railspgAdmin III Why query results are shortened?The required column was not present in the results of a 'FromSql' operationEF Core FromSQL query does not get executed immediately (PostgreSQL)EF Core FromSql Returning Odd Error MessageEntity Framework Core - FromSql error:PostgreSQL & PgAdmin set session variable to query resultHow to use parameters in Linq FromSQL QueryThe required column 'CustomerId' was not present in the results of a 'FromSql' operation
If a Druid sees an animal’s corpse, can they Wild Shape into that animal?
A poker game description that does not feel gimmicky
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Protecting Dualbooting Windows from dangerous code (like rm -rf)
Worn-tile Scrabble
Why did Acorn's A3000 have red function keys?
Return to UK after being refused entry years previously
Aging parents with no investments
Can a flute soloist sit?
What do hard-Brexiteers want with respect to the Irish border?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
How to notate time signature switching consistently every measure
What is the accessibility of a package's `Private` context variables?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Reference request: Oldest number theory books with (unsolved) exercises?
Shouldn't "much" here be used instead of "more"?
Why is the Constellation's nose gear so long?
Why do UK politicians seemingly ignore opinion polls on Brexit?
What is the meaning of Triage in Cybersec world?
How technical should a Scrum Master be to effectively remove impediments?
Button changing it's text & action. Good or terrible?
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Time travel alters history but people keep saying nothing's changed
FromSql results in error, while query is working in pgAdmin
The 2019 Stack Overflow Developer Survey Results Are InConvert Linq Query Result to DictionaryGetting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with railspgAdmin III Why query results are shortened?The required column was not present in the results of a 'FromSql' operationEF Core FromSQL query does not get executed immediately (PostgreSQL)EF Core FromSql Returning Odd Error MessageEntity Framework Core - FromSql error:PostgreSQL & PgAdmin set session variable to query resultHow to use parameters in Linq FromSQL QueryThe required column 'CustomerId' was not present in the results of a 'FromSql' operation
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
In order to replace the following query which generate IN clause with 100+ elements inside and take 8.4 seconds:
List<AnalysisModel> analyses = AppDbContext.Analysis.Where(m => Id.Contains(m.TestId) & phasesAll.Contains(m.PhaseId)).AsNoTracking().ToList();
I use manual query:
string analysisQuery = $"SELECT id, time, compound, reagent, product, phase, conc, test_id FROM public.analysis INNER JOIN (VALUES stringHelper.WrapGuidToString(Id, GuidWrapper) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES stringHelper.WrapIntToString(phasesAll, IntWrapper) ) phase_val (p)ON (phase = p)";
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
If I execute query generated in analysisQuery
in pgAdmin it executes and provides the same table as the first expression (in 0.9 s). However when I execute through FromSql
I receive the following error:
System.FormatException: 'Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.'
Any suggestions why FromSql
is not working correctly here?
stringHelper.WrapGuidToString()
and stringHelper.WrapIntToString()
wraps Guid and string into the appropriate format, e.g. (Guid1), (Guid2) and (1), (2) for Guid and Int respectively. The query generated via this method can be executed in pgAdmin without problems:
public string WrapIntToString(List<int> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
WrapGuidToString
code:
public string WrapGuidToString(List<Guid> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
Where wrapper
is
private WrapModel GuidWrapper => new WrapModel()
LeftWrapper = "('",
RightWrapper = "'::uuid)",
Separator = ","
;
c# postgresql .net-core entity-framework-core
|
show 8 more comments
In order to replace the following query which generate IN clause with 100+ elements inside and take 8.4 seconds:
List<AnalysisModel> analyses = AppDbContext.Analysis.Where(m => Id.Contains(m.TestId) & phasesAll.Contains(m.PhaseId)).AsNoTracking().ToList();
I use manual query:
string analysisQuery = $"SELECT id, time, compound, reagent, product, phase, conc, test_id FROM public.analysis INNER JOIN (VALUES stringHelper.WrapGuidToString(Id, GuidWrapper) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES stringHelper.WrapIntToString(phasesAll, IntWrapper) ) phase_val (p)ON (phase = p)";
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
If I execute query generated in analysisQuery
in pgAdmin it executes and provides the same table as the first expression (in 0.9 s). However when I execute through FromSql
I receive the following error:
System.FormatException: 'Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.'
Any suggestions why FromSql
is not working correctly here?
stringHelper.WrapGuidToString()
and stringHelper.WrapIntToString()
wraps Guid and string into the appropriate format, e.g. (Guid1), (Guid2) and (1), (2) for Guid and Int respectively. The query generated via this method can be executed in pgAdmin without problems:
public string WrapIntToString(List<int> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
WrapGuidToString
code:
public string WrapGuidToString(List<Guid> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
Where wrapper
is
private WrapModel GuidWrapper => new WrapModel()
LeftWrapper = "('",
RightWrapper = "'::uuid)",
Separator = ","
;
c# postgresql .net-core entity-framework-core
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
InList<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.
– Kostya Kartavenka
Mar 23 at 5:50
FromSql
is your dll? if not then can you show some details here?FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql
– Kostya Kartavenka
Mar 25 at 1:51
Did you try to runFromSql
with a simple query? something likeselect id, time, compound, from public.analysis
then pass this query to yourFromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35
|
show 8 more comments
In order to replace the following query which generate IN clause with 100+ elements inside and take 8.4 seconds:
List<AnalysisModel> analyses = AppDbContext.Analysis.Where(m => Id.Contains(m.TestId) & phasesAll.Contains(m.PhaseId)).AsNoTracking().ToList();
I use manual query:
string analysisQuery = $"SELECT id, time, compound, reagent, product, phase, conc, test_id FROM public.analysis INNER JOIN (VALUES stringHelper.WrapGuidToString(Id, GuidWrapper) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES stringHelper.WrapIntToString(phasesAll, IntWrapper) ) phase_val (p)ON (phase = p)";
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
If I execute query generated in analysisQuery
in pgAdmin it executes and provides the same table as the first expression (in 0.9 s). However when I execute through FromSql
I receive the following error:
System.FormatException: 'Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.'
Any suggestions why FromSql
is not working correctly here?
stringHelper.WrapGuidToString()
and stringHelper.WrapIntToString()
wraps Guid and string into the appropriate format, e.g. (Guid1), (Guid2) and (1), (2) for Guid and Int respectively. The query generated via this method can be executed in pgAdmin without problems:
public string WrapIntToString(List<int> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
WrapGuidToString
code:
public string WrapGuidToString(List<Guid> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
Where wrapper
is
private WrapModel GuidWrapper => new WrapModel()
LeftWrapper = "('",
RightWrapper = "'::uuid)",
Separator = ","
;
c# postgresql .net-core entity-framework-core
In order to replace the following query which generate IN clause with 100+ elements inside and take 8.4 seconds:
List<AnalysisModel> analyses = AppDbContext.Analysis.Where(m => Id.Contains(m.TestId) & phasesAll.Contains(m.PhaseId)).AsNoTracking().ToList();
I use manual query:
string analysisQuery = $"SELECT id, time, compound, reagent, product, phase, conc, test_id FROM public.analysis INNER JOIN (VALUES stringHelper.WrapGuidToString(Id, GuidWrapper) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES stringHelper.WrapIntToString(phasesAll, IntWrapper) ) phase_val (p)ON (phase = p)";
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
If I execute query generated in analysisQuery
in pgAdmin it executes and provides the same table as the first expression (in 0.9 s). However when I execute through FromSql
I receive the following error:
System.FormatException: 'Index (zero based) must be greater than or
equal to zero and less than the size of the argument list.'
Any suggestions why FromSql
is not working correctly here?
stringHelper.WrapGuidToString()
and stringHelper.WrapIntToString()
wraps Guid and string into the appropriate format, e.g. (Guid1), (Guid2) and (1), (2) for Guid and Int respectively. The query generated via this method can be executed in pgAdmin without problems:
public string WrapIntToString(List<int> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
WrapGuidToString
code:
public string WrapGuidToString(List<Guid> input, WrapModel wrapper)
List<string> prep = new List<string>();
input.ForEach(m => prep.Add(wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper));
return string.Join(wrapper.Separator, prep);
Where wrapper
is
private WrapModel GuidWrapper => new WrapModel()
LeftWrapper = "('",
RightWrapper = "'::uuid)",
Separator = ","
;
c# postgresql .net-core entity-framework-core
c# postgresql .net-core entity-framework-core
edited Mar 25 at 19:51
Kostya Kartavenka
asked Mar 22 at 3:45
Kostya KartavenkaKostya Kartavenka
2511
2511
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
InList<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.
– Kostya Kartavenka
Mar 23 at 5:50
FromSql
is your dll? if not then can you show some details here?FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql
– Kostya Kartavenka
Mar 25 at 1:51
Did you try to runFromSql
with a simple query? something likeselect id, time, compound, from public.analysis
then pass this query to yourFromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35
|
show 8 more comments
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
InList<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.
– Kostya Kartavenka
Mar 23 at 5:50
FromSql
is your dll? if not then can you show some details here?FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql
– Kostya Kartavenka
Mar 25 at 1:51
Did you try to runFromSql
with a simple query? something likeselect id, time, compound, from public.analysis
then pass this query to yourFromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
In
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.– Kostya Kartavenka
Mar 23 at 5:50
In
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.– Kostya Kartavenka
Mar 23 at 5:50
FromSql
is your dll? if not then can you show some details here? FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is your dll? if not then can you show some details here? FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql– Kostya Kartavenka
Mar 25 at 1:51
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql– Kostya Kartavenka
Mar 25 at 1:51
Did you try to run
FromSql
with a simple query? something like select id, time, compound, from public.analysis
then pass this query to your FromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35
Did you try to run
FromSql
with a simple query? something like select id, time, compound, from public.analysis
then pass this query to your FromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35
|
show 8 more comments
1 Answer
1
active
oldest
votes
I got your problem:
wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper
It seems like you have created a string format yourStringValueHere
that is why your got this error Zero index
String.Format("012","Value1","Value2","Value3")
It must look like that.
This one m.ToString()
with your wrapper is wrong instead of an integer
then followed by the value
Take a look at the content of your WrapGuidToString
or WrapIntToString
if it is in a correct format. This is your main issue here.
Nope, example of Sql query I am generating:SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing::uuid
. Do not see your code working.
– Kostya Kartavenka
Mar 26 at 19:04
I think yourVS consider this as string format. try it with a simple query like
select * from table
without any join.. if the error occur.
– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistakenFromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see thatFromSql
has problems. Without inner join there is no point for me because of performance.
– Kostya Kartavenka
Mar 28 at 2:24
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292593%2ffromsql-results-in-error-while-query-is-working-in-pgadmin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I got your problem:
wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper
It seems like you have created a string format yourStringValueHere
that is why your got this error Zero index
String.Format("012","Value1","Value2","Value3")
It must look like that.
This one m.ToString()
with your wrapper is wrong instead of an integer
then followed by the value
Take a look at the content of your WrapGuidToString
or WrapIntToString
if it is in a correct format. This is your main issue here.
Nope, example of Sql query I am generating:SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing::uuid
. Do not see your code working.
– Kostya Kartavenka
Mar 26 at 19:04
I think yourVS consider this as string format. try it with a simple query like
select * from table
without any join.. if the error occur.
– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistakenFromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see thatFromSql
has problems. Without inner join there is no point for me because of performance.
– Kostya Kartavenka
Mar 28 at 2:24
add a comment |
I got your problem:
wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper
It seems like you have created a string format yourStringValueHere
that is why your got this error Zero index
String.Format("012","Value1","Value2","Value3")
It must look like that.
This one m.ToString()
with your wrapper is wrong instead of an integer
then followed by the value
Take a look at the content of your WrapGuidToString
or WrapIntToString
if it is in a correct format. This is your main issue here.
Nope, example of Sql query I am generating:SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing::uuid
. Do not see your code working.
– Kostya Kartavenka
Mar 26 at 19:04
I think yourVS consider this as string format. try it with a simple query like
select * from table
without any join.. if the error occur.
– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistakenFromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see thatFromSql
has problems. Without inner join there is no point for me because of performance.
– Kostya Kartavenka
Mar 28 at 2:24
add a comment |
I got your problem:
wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper
It seems like you have created a string format yourStringValueHere
that is why your got this error Zero index
String.Format("012","Value1","Value2","Value3")
It must look like that.
This one m.ToString()
with your wrapper is wrong instead of an integer
then followed by the value
Take a look at the content of your WrapGuidToString
or WrapIntToString
if it is in a correct format. This is your main issue here.
I got your problem:
wrapper.LeftWrapper + m.ToString() + wrapper.RightWrapper
It seems like you have created a string format yourStringValueHere
that is why your got this error Zero index
String.Format("012","Value1","Value2","Value3")
It must look like that.
This one m.ToString()
with your wrapper is wrong instead of an integer
then followed by the value
Take a look at the content of your WrapGuidToString
or WrapIntToString
if it is in a correct format. This is your main issue here.
edited Mar 26 at 7:18
answered Mar 26 at 7:13
Vijunav VastivchVijunav Vastivch
3,4411724
3,4411724
Nope, example of Sql query I am generating:SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing::uuid
. Do not see your code working.
– Kostya Kartavenka
Mar 26 at 19:04
I think yourVS consider this as string format. try it with a simple query like
select * from table
without any join.. if the error occur.
– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistakenFromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see thatFromSql
has problems. Without inner join there is no point for me because of performance.
– Kostya Kartavenka
Mar 28 at 2:24
add a comment |
Nope, example of Sql query I am generating:SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing::uuid
. Do not see your code working.
– Kostya Kartavenka
Mar 26 at 19:04
I think yourVS consider this as string format. try it with a simple query like
select * from table
without any join.. if the error occur.
– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistakenFromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see thatFromSql
has problems. Without inner join there is no point for me because of performance.
– Kostya Kartavenka
Mar 28 at 2:24
Nope, example of Sql query I am generating:
SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing ::uuid
. Do not see your code working.– Kostya Kartavenka
Mar 26 at 19:04
Nope, example of Sql query I am generating:
SELECT id, compound, conc, phase, product, reagent, test_id, time FROM public.analysis INNER JOIN (VALUES ('85025e34-b45c-412f-ba45-e2c49d2a3bae'::uuid),('11f99597-56a3-44bd-ad6c-9da16143057a'::uuid) ) testid_val (v) ON (test_id = v) INNER JOIN (VALUES (2),(4),(5),(9)) phase_val (p) ON (phase = p)
. Again, it is working in pgAdmin. There is no wrong in my wrapping approach, it is not creating string values and when it looks like a string, I am casting a correct type via providing ::uuid
. Do not see your code working.– Kostya Kartavenka
Mar 26 at 19:04
I think your
VS consider this as string format. try it with a simple query like select * from table
without any join.. if the error occur.– Vijunav Vastivch
Mar 27 at 0:37
I think your
VS consider this as string format. try it with a simple query like select * from table
without any join.. if the error occur.– Vijunav Vastivch
Mar 27 at 0:37
Simple queries like this it process easily. If I am not mistaken
FromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see that FromSql
has problems. Without inner join there is no point for me because of performance.– Kostya Kartavenka
Mar 28 at 2:24
Simple queries like this it process easily. If I am not mistaken
FromSql
should just execute as is and receive table back and then if the table is incorrect format -- there error should happen. Since query is working I can only see that FromSql
has problems. Without inner join there is no point for me because of performance.– Kostya Kartavenka
Mar 28 at 2:24
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292593%2ffromsql-results-in-error-while-query-is-working-in-pgadmin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In which part of your code the error returns exactly.
– Vijunav Vastivch
Mar 22 at 6:06
In
List<AnalysisModel> analyses = AppDbContext.Analysis.FromSql(analysisQuery).AsNoTracking().ToList();
.– Kostya Kartavenka
Mar 23 at 5:50
FromSql
is your dll? if not then can you show some details here?FromSql
– Vijunav Vastivch
Mar 25 at 1:21
FromSql
is a part of EF .Net Core, I do not know what is behind it: docs.microsoft.com/en-us/ef/core/querying/raw-sql– Kostya Kartavenka
Mar 25 at 1:51
Did you try to run
FromSql
with a simple query? something likeselect id, time, compound, from public.analysis
then pass this query to yourFromSql(analysisQuery)
– Vijunav Vastivch
Mar 25 at 3:35