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;








0















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 = ","
;









share|improve this question
























  • 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 like select id, time, compound, from public.analysis then pass this query to your FromSql(analysisQuery)

    – Vijunav Vastivch
    Mar 25 at 3:35


















0















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 = ","
;









share|improve this question
























  • 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 like select id, time, compound, from public.analysis then pass this query to your FromSql(analysisQuery)

    – Vijunav Vastivch
    Mar 25 at 3:35














0












0








0








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 = ","
;









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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











  • 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 like select id, time, compound, from public.analysis then pass this query to your FromSql(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 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 like select id, time, compound, from public.analysis then pass this query to your FromSql(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













1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer

























  • 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











  • 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











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
);



);













draft saved

draft discarded


















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









0














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.






share|improve this answer

























  • 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











  • 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















0














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.






share|improve this answer

























  • 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











  • 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













0












0








0







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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 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

















  • 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











  • 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
















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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현