Help with syntax error

2024-12-01 Thread Arbol One
'Kennedy'); <= **/UserNameTable.write()/* I get this message : */Exception in thread "main" java.sql.SQLException: In company.contact.Company$UserNameTable.write() ERROR: syntax error at or near "'18551420601012L23'"   Position: 23/ * The error is in the user_nam

Re: Help with syntax error

2024-12-01 Thread Ron Johnson
7;12', > '2024', '18', '55', '14', '207', 'PM'); INSERT INTO user_name > '18551420601012L23', 'John', 'Fitzgerald', 'Kennedy'); <= * > *UserNameTable.write()* > > I get this message : > >

Re: Help with syntax error

2024-12-01 Thread Arbol One
t see the difference between the first and second statements. Hint, it starts with V. I get this message : */Exception in thread "main" java.sql.SQLException: In company.contact.Company$UserNameTable.write() ERROR: syntax error at or near "'18551420601012L23'&q

Re: Help with syntax error

2024-12-01 Thread Adrian Klaver
tzgerald', 'Kennedy'); <= **/UserNameTable.write()/* You don't see the difference between the first and second statements. Hint, it starts with V. I get this message : */Exception in thread "main" java.sql.SQLException: In company.contact.Company$UserN

Re: PQexecParams and "SET TIME ZONE $1" gets 'syntax error at or near "$1" at character 15'

2024-11-23 Thread Pavel Stehule
Hi so 23. 11. 2024 v 16:01 odesílatel napsal: > I get get this same error > > syntax error at or near "$1" at character 15 > > if I feed "const char *command" with the following texts. > > SET TIME ZONE $1 > SET TIME ZONE $1::TEXT > > For some

PQexecParams and "SET TIME ZONE $1" gets 'syntax error at or near "$1" at character 15'

2024-11-23 Thread ma.sao
I get get this same error syntax error at or near "$1" at character 15 if I feed "const char *command" with the following texts. SET TIME ZONE $1 SET TIME ZONE $1::TEXT For some reasons, I can not add quotes around $1 as follows. SET TIME ZONE '$1' SET TIME ZO

Re: Syntax on BEFORE Trigger - Cascade?

2024-06-13 Thread David G. Johnston
creating a before trigger on import_job, > Why? > > but can't seem to get the right syntax for taking the oid from the psql > delete picked up by the trigger. > Your broken attempt to do this is likely what is causing the error. > > Here is one of my (many) attempts (ha

Re: Syntax on BEFORE Trigger - Cascade?

2024-06-13 Thread Tom Lane
David Barbour writes: > The files are appropriately deleted in Oracle, but Postgres is returning > the following: > *ERROR: Attempt to suppress referential action with before trigger. > CONTEXT: SQL statement "DELETE FROM ONLY "idev"."import_file" WHERE $1 > OPERATOR(pg_catalog.=) "import_job_oid"

Syntax on BEFORE Trigger - Cascade?

2024-06-13 Thread David Barbour
the heck out of this and played all sorts of games with the tables. I've also tried creating a before trigger on import_job, but can't seem to get the right syntax for taking the oid from the psql delete picked up by the trigger. Here is one of my (many) attempts (have tried describing,

Re: Timeout gets unset on a syntax error.

2024-05-29 Thread Greg Sabino Mullane
On Wed, May 29, 2024 at 6:29 AM ISHAN CHHANGANI . < f20200...@hyderabad.bits-pilani.ac.in> wrote: > Is there some code within Postgres that resets/removes the signals in case > a query hits any error? > See the comment and call to disable_all_timeouts() in postgres.c, part of the cleanup-after-ex

Timeout gets unset on a syntax error.

2024-05-29 Thread ISHAN CHHANGANI .
On a particular query, I start an alarm (say for 5 sec) using RegisterTimeout , and when the alarm rings, I log something. This works fine. But if I run a query with a syntax error between the time duration, then the alarm never rings. Is there some code within Postgres that resets/removes the

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: Show the complete query. Take the error message as correct, you are specifying 'companies as c' more then once. Adrian, I saw that but didn't know how to specify the alias only one time. Thanks, Rich

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Ray O'Donnell wrote: Look again at Shammat's example! - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p   LEFT JOIN companies as c ON c.company_nbr = p.company_nbr NB - "... from people as p left join companies as c on " -

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: The query needs to be: SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Only reference companies as c once. Thanks, Adrian. I mis-read your origi

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
On 2024-05-18 17:12 +0200, David G. Johnston wrote: > Too lazy to find the docs right now but what you are observing is basically > an operator precedence effect. The comma join hasn’t happened at the time > the left join is evaluated and so other tables in the comma join cannot > appear in the on

Re: Left join syntax error

2024-05-18 Thread David G. Johnston
On Sat, May 18, 2024 at 7:49 AM Adrian Klaver wrote: > On 5/18/24 07:46, Rich Shepard wrote: > > On Sat, 18 May 2024, Shammat wrote: > > > >> Don't put the second table in the FROM part > >> > >> SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > >> c.company_name > >> FROM people as

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Erik Wienhold wrote: Yes, Rich probably just wants the left join. Eric, You're correct: I want certain colums from the people table with their company name from the companies table. But I wonder if the implicit cross join syntax ("FROM peoples, companie

Re: Left join syntax error

2024-05-18 Thread Tom Lane
Erik Wienhold writes: > But I wonder if the implicit cross join syntax ("FROM peoples, companies") > should actually produce this error because the explicit cross join > works: > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > c.company_na

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
I wrote: > But I wonder if the implicit cross join syntax ("FROM peoples, companies") > should actually produce this error because the explicit cross join > works: > > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, > c.company_name > FROM p

Re: Left join syntax error

2024-05-18 Thread David G. Johnston
^ > > > HINT: There is an entry for table "p", but it cannot be referenced > from this part of the query. > > > > Don't put the second table in the FROM part > > > > SELECT p.lname, p.fname, p.job_title, p.company_nbr

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 08:04, Rich Shepard wrote: On Sat, 18 May 2024, Adrian Klaver wrote: ... LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Adrian, Tried that: bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR:  table name "c" specified more than once Show the c

Re: Left join syntax error

2024-05-18 Thread Ray O'Donnell
On 18/05/2024 16:01, Rich Shepard wrote: On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Adrian Klaver wrote: ... LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; Adrian, Tried that: bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR: table name "c" specified more than once Thanks, Rich

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 08:01, Rich Shepard wrote: On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON c.c

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Ray O'Donnell wrote: You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray, That didn't work: bustrac-# FROM people as p, companies as c bustrac-# LEFT JOIN companies as c ON c.company_nbr = p.company_nbr; ERROR: tab

Re: Left join syntax error

2024-05-18 Thread Erik Wienhold
this part of the query. > > Don't put the second table in the FROM part > > SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name > FROM people as p > LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Yes, Rich probably just wants the left jo

Re: Left join syntax error

2024-05-18 Thread Adrian Klaver
On 5/18/24 07:46, Rich Shepard wrote: On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p  LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I tried t

Re: Left join syntax error

2024-05-18 Thread Ray O'Donnell
On 18/05/2024 15:46, Rich Shepard wrote: On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p  LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I trie

Re: Left join syntax error

2024-05-18 Thread Rich Shepard
On Sat, 18 May 2024, Shammat wrote: Don't put the second table in the FROM part SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p LEFT JOIN companies as c ON c.company_nbr = p.company_nbr Shammat, I tried this with this result: ERROR: missing FR

Re: Left join syntax error

2024-05-18 Thread Shammat
Am 18.05.24 um 14:52 schrieb Rich Shepard: It's been a _very_ long time since I wrote a SQL script and, despite looking at my SQL books and web pages, I don't know how to fix the error. The three line script is: - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name

Left join syntax error

2024-05-18 Thread Rich Shepard
It's been a _very_ long time since I wrote a SQL script and, despite looking at my SQL books and web pages, I don't know how to fix the error. The three line script is: - SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, c.company_name FROM people as p, companies as c LEFT JOIN

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Adrian Klaver
On 2/18/24 10:40, Adrian Klaver wrote: On 2/18/24 10:30, Laura Smith wrote: There's not bespoke SQL syntax for constructing a range. You must use a function, something like VALUES(p_event_id, tstzrange(p_start_time,p_end_time,'[)')) ... Thanks all for your swift replies.

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Adrian Klaver
On 2/18/24 10:30, Laura Smith wrote: There's not bespoke SQL syntax for constructing a range. You must use a function, something like VALUES(p_event_id, tstzrange(p_start_time,p_end_time,'[)')) ... Thanks all for your swift replies. Serves me right for assuming I cou

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Laura Smith
> > There's not bespoke SQL syntax for constructing a range. You must > use a function, something like > > VALUES(p_event_id, tstzrange(p_start_time,p_end_time,'[)')) ... Thanks all for your swift replies. Serves me right for assuming I could use variable

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Tom Lane
Laura Smith writes: > I'm sure I'm doing something stupid here, but I think I've got the syntax > right ? > The error I'm seeing: > psql:event_session_funcs.sql:26: ERROR:  syntax error at or near "[" > LINE 11:         VALUES(p_event_id,[p_start_time

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Adrian Klaver
On 2/18/24 09:40, Laura Smith wrote: I'm sure I'm doing something stupid here, but I think I've got the syntax right ? The error I'm seeing: psql:event_session_funcs.sql:26: ERROR:  syntax error at or near "[" LINE 11:         VALUES(p_event_id,[p_start_time,p_en

Re: Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread David G. Johnston
On Sunday, February 18, 2024, Laura Smith < n5d9xq3ti233xiyif...@protonmail.ch> wrote: > I'm sure I'm doing something stupid here, but I think I've got the syntax > right ? > > The error I'm seeing: > psql:event_session_funcs.sql:26: ERROR: syntax error

Function inserting into tstzrange ? (syntax error at or near...)

2024-02-18 Thread Laura Smith
I'm sure I'm doing something stupid here, but I think I've got the syntax right ? The error I'm seeing: psql:event_session_funcs.sql:26: ERROR:  syntax error at or near "[" LINE 11:         VALUES(p_event_id,[p_start_time,p_end_time)) RETURNI... The functi

Re: Syntax

2023-12-07 Thread Ron Johnson
On Thu, Dec 7, 2023 at 3:01 AM arun chirappurath wrote: > Hi All, > > What is the difference or use case for below syntaxes? > > do $$ > declare d int; > begin > RAISE INFO 'Script started at %', CURRENT_TIMESTAMP; > update employees set first_name = 'g' where employee_id = 1; get > diagnostics d

Syntax

2023-12-07 Thread arun chirappurath
Hi All, What is the difference or use case for below syntaxes? do $$ declare d int; begin RAISE INFO 'Script started at %', CURRENT_TIMESTAMP; update employees set first_name = 'g' where employee_id = 1; get diagnostics d = row_count; raise info 'selected: % rows', d; RAISE INFO 'Script finished

Re: Failed to parse new syntax

2023-08-05 Thread Jan Wieck
; This is my new grammer. But I get below: postgres=# select * from t2 where [a ~ 1] < 0; ERROR: syntax error at or near "~" LINE 1: select * from t2 where [a ~ 1] < 0; It’s strange that it can’t parse ‘~’, I add it in the parser.

Failed to parse new syntax

2023-08-05 Thread jacktby jacktby
rget->location = @1; $$ = list_make1(target); } | col_list_expr ',' columnref { $$ = lappend($1,$3);} ; This is my new grammer. But I get below: postgres=# select * from t2 where [a ~ 1] < 0; ERROR: syntax error at or near "~" LINE 1: select * from t2 where [a ~ 1] < 0; It’s strange that it can’t parse ‘~’, I add it in the parser.

Why lex & yacc think this is a syntax error?

2023-06-09 Thread Wen Yi
Hi team, I am learning the yacc & lex and want to use it to make a config parser, as you can see, the config file is following these rules: key = value For example: memory_limit = 512 memory_unit = 'MB' time_limit = 12 time_unit = 's' And I make such a yacc & lex rule file: /*     conf

Re: syntax pb

2023-05-30 Thread Marc Millas
Thanks for the explanation. Crystal clear, thanks Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Tue, May 30, 2023 at 7:31 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Tue, May 30, 2023 at 8:53 AM Marc Millas > wrote > >> Too my understanding it looks like the parser

Re: syntax pb

2023-05-30 Thread Marc Millas
and query writing concerns to deal with in > addition to being able to identify the problems specific error messages are > pointing out and trying to fix them. > Hi David, my guess about the distinct syntax was just because if I take the distinct OUT, the SQL works fine. nothing more, nothing less... > > David J. > >

Re: syntax pb

2023-05-30 Thread Marc Millas
but expression is of type text >> LINE 2: Select distinct test1.t, 'abc' as b, NULL as c, NULL as d >> >> HINT: You will need to rewrite or cast the expression. >> >> Can someone give a short SQL syntax hint ? >> > > > https://www.postgresql.org/do

Re: syntax pb

2023-05-30 Thread Adrian Klaver
On 5/30/23 8:53 AM, Marc Millas wrote: Thanks Adrian, but if the query becomes more complex, for example with a few joins more, then even casting doesn't work. This comes from a prod environment and even casting NULLs (which is more than strange, BTW) generates absurd errors. Too my underst

Re: syntax pb

2023-05-30 Thread Adrian Klaver
On 5/30/23 10:31 AM, Tom Lane wrote: "David G. Johnston" writes: On Tue, May 30, 2023 at 8:53 AM Marc Millas wrote Too my understanding it looks like the parser did not parse the select distinct as we think he does. The DISTINCT clause doesn't really come into play here at all, so if you t

Re: syntax pb

2023-05-30 Thread Tom Lane
"David G. Johnston" writes: > On Tue, May 30, 2023 at 8:53 AM Marc Millas wrote >> Too my understanding it looks like the parser did not parse the select >> distinct as we think he does. > The DISTINCT clause doesn't really come into play here at all, so if you > think it does you indeed have a

Re: syntax pb

2023-05-30 Thread David G. Johnston
On Tue, May 30, 2023 at 8:53 AM Marc Millas wrote > This comes from a prod environment and even casting NULLs (which is more > than strange, BTW) generates absurd errors. > If you want an input to be anything other than plain text (numbers partially exempted) you need to cast it. Sure, some li

Re: syntax pb

2023-05-30 Thread hubert depesz lubaczewski
On Tue, May 30, 2023 at 05:53:30PM +0200, Marc Millas wrote: > Thanks Adrian, but if the query becomes more complex, for example with a > few joins more, then even casting doesn't work. > This comes from a prod environment and even casting NULLs (which is more > than strange, BTW) generates absurd

Re: syntax pb

2023-05-30 Thread Marc Millas
The above should have been: > > Insert into t2 (a, b, c, d) > Select distinct test1.t, 'abc' as b, NULL::text, NULL::numeric > From t1 test1; > > > > > which results in: > > > > select * from t2; > > a| b | c | d > > +-+--+-- > > azerty | abc | NULL | NULL > > >

Re: syntax pb

2023-05-30 Thread Adrian Klaver
On 5/30/23 07:38, Adrian Klaver wrote: On 5/30/23 06:45, Marc Millas wrote: Hi, I always have had difficulties to understand syntax. So... If I have: create table t1 (t text); create table t2 (a text, b text, c test, d numeric); Is c supposed to be text? Or are you indeed referring to some

Re: syntax pb

2023-05-30 Thread Adrian Klaver
On 5/30/23 06:45, Marc Millas wrote: Hi, I always have had difficulties to understand syntax. So... If I have: create table t1 (t text); create table t2 (a text, b text, c test, d numeric); Is c supposed to be text? Or are you indeed referring to some unspecified type? insert into t1

Re: syntax pb

2023-05-30 Thread Ray O'Donnell
stinct test1.t, 'abc' as b, NULL as c, NULL as d HINT:  You will need to rewrite or cast the expression. I'm guessing you'll need to cast the NULLs: select distinct test1.t, 'abc', null::text, null::numeric ... I don't think you need the aliases. Ray.

Re: syntax pb

2023-05-30 Thread David G. Johnston
On Tuesday, May 30, 2023, Marc Millas wrote: > > I get: > ERROR: column "d" is of type numeric but expression is of type text > LINE 2: Select distinct test1.t, 'abc' as b, NULL as c, NULL as d > > HINT: You will need to rewrite or cast the expression. &

syntax pb

2023-05-30 Thread Marc Millas
Hi, I always have had difficulties to understand syntax. So... If I have: create table t1 (t text); create table t2 (a text, b text, c test, d numeric); insert into t1('azerty'); INSERT 0 1 fine ! so, now, if I write: Select distinct test1.t, 'abc' as b, NULL as c, NULL

Re: missing something about json syntax

2023-04-21 Thread Marc Millas
Ok, thanks. Le jeu. 20 avr. 2023 à 22:42, Tom Lane a écrit : > Marc Millas writes: > > but it doesnt explain how postgres is able to put a scalar in a json or > > jsonb column without pb: > > I don't understand how this ('"{\"t\"}"') can be considered a valid > enough > > json to be inserted i

Re: missing something about json syntax

2023-04-20 Thread Tom Lane
Marc Millas writes: > but it doesnt explain how postgres is able to put a scalar in a json or > jsonb column without pb: > I don't understand how this ('"{\"t\"}"') can be considered a valid enough > json to be inserted in a json column > and at the same time invalid for all other json uses. Tha

Re: missing something about json syntax

2023-04-20 Thread Marc Millas
Thanks for your input. select (_data->>'log')::json->'level' from mytable; this does work. but it doesnt explain how postgres is able to put a scalar in a json or jsonb column without pb: I don't understand how this ('"{\"t\"}"') can be considered a valid enough json to be inserted in a json colu

Re: missing something about json syntax

2023-04-20 Thread Erik Wienhold
> On 20/04/2023 18:35 CEST Marc Millas wrote: > > Hi, > > postgres 15 > > looks Iike I am missing something, maybe obvious :-( > In a table with a json column (_data) if I ask psql to select _data from > mytable with a where clause to get only one line,, I get something beginning > by > {"time":"2

missing something about json syntax

2023-04-20 Thread Marc Millas
Hi, postgres 15 looks Iike I am missing something, maybe obvious :-( In a table with a json column (_data) if I ask psql to select _data from mytable with a where clause to get only one line,, I get something beginning by {"time":"2023-04-19T16:28:01.19780551+02:00","stream":"stderr","_p":"F","

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-10 Thread David G. Johnston
On Fri, Mar 10, 2023 at 1:29 PM Bryn Llewellyn wrote: > > david.g.johns...@gmail.com wrote: > > > >> b...@yugabyte.com wrote: > >> > >> « > >> SELECT select_expressions INTO [STRICT] target FROM …; > >> > >> where target can be a record variable, a row variable, or a > comma-separated list of sim

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-10 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > >> b...@yugabyte.com wrote: >> >> « >> SELECT select_expressions INTO [STRICT] target FROM …; >> >> where target can be a record variable, a row variable, or a comma-separated >> list of simple variables and record/row fields. >> » >> >> In plain English,

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-09 Thread David G. Johnston
On Thu, Mar 9, 2023 at 12:46 PM Bryn Llewellyn wrote: > « > SELECT select_expressions INTO [STRICT] target FROM …; > > where target can be a record variable, a row variable, or a > comma-separated list of simple variables and record/row fields. > » > > In plain English, the "into" target cannot b

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-09 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > >> b...@yugabyte.com wrote: >> >> r := (my_c1, my_c2)::s.t; >> >> If you write s.x there it will also work. > > Your first and third assignments are identical in syntax/nature. These are > both the fir

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-08 Thread David G. Johnston
On Wed, Mar 8, 2023 at 7:58 PM Bryn Llewellyn wrote: > > r := (my_c1, my_c2)::s.t; > If you write s.x there it will also work. Your first and third assignments are identical in syntax/nature. These are both the first examples here[1] Yes, the behavior of INTO in the second assi

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-08 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > >> b...@yugabyte.com writes: >>select (17, 42)::s.t2 into r2; >> [ doesn't work ] > > This would work as > > select 17, 42 into r2; > > In general, SELECT INTO with a composite target expects to see a source > column per target field. If you want to assign a

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-08 Thread Tom Lane
Bryn Llewellyn writes: > select (17, 42)::s.t2 into r2; > [ doesn't work ] This would work as select 17, 42 into r2; In general, SELECT INTO with a composite target expects to see a source column per target field. If you want to assign a composite value to the whole target, don't use

Re: select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-08 Thread David G. Johnston
On Wed, Mar 8, 2023 at 5:41 PM Bryn Llewellyn wrote: > > select (((17, 42)::s.t2)::text)::s.t2 into r2; > > then I'm back to the same 22P02 error: > > invalid input syntax for type integer: "(17,42)" > > Single quotes. SELECT '(17,42)'::s.t2; David J.

select (17, 42)::s.t2 into... fails with "invalid input syntax"

2023-03-08 Thread Bryn Llewellyn
return next; select ('cat', 'dog')::s.t1 into r1; z := '2: '||r1.c1||' / '||coalesce(r1.c2, '');return next; r2 := (select (17, 42)::s.t2); z := '3: '||(r2.c1)::text||' / '||(r2.c2)::text;

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Tom Lane
Marc Millas writes: > I read your answer, Tom, but I cannot connect it to my measurements: why > adding the index did slow the request twice ?? Are you referring to >>> if I do create a gist index on geometry column of the big table, >>> both syntax takes 21 seconds.

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Marc Millas
I read your answer, Tom, but I cannot connect it to my measurements: why adding the index did slow the request twice ?? Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Sat, Jan 7, 2023 at 10:33 PM Tom Lane wrote: > Marc Millas writes: > > 2023=# explain (analyze, buffers) select

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Tom Lane
Marc Millas writes: > 2023=# explain (analyze, buffers) select A.x, count(B.x) from A left join B > on st_within(B.geom, A.geom) group by A.x; So the problem with this is that the only decently-performant way to do the join is like > -> Nested Loop (cost=0.13..6275745.36 r

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Marc Millas
left join B on st_within(B.y, A.y) group > by A.x; > > same result, but 85 seconds (every thing in shared buffers, again) > > if I redo asking with explain analyze, buffers, the plan is very > different. > > > > > > if I do create a gist index on geometry column

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Erik Wienhold
ers, the plan is very different. > > > if I do create a gist index on geometry column of the big table, both syntax > takes 21 seconds. > > I get the feeling I am missing something.. (at least 2 things...) > can someone shed some light ?? Please provide the executions plans for both queries with and without the index on B.y. -- Erik

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Marc Millas
on postgres 15 and postgis 3.3, with the very same dataset, without gist index on the 420k rows table, the syntax with the left join takes 25 seconds, and without 770 ms. so to get 5 empty lines its 30 times slower. if I add the gist index, both syntaxes takes 770 ms... at least, this close the

Re: impact join syntax ?? and gist index ??

2023-01-07 Thread Marc Millas
Yes, I know the 2 syntax provide a different result: one provides the 6 meaningful lines, the left join do add 5 lines with a count of 0... ... Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Sat, Jan 7, 2023 at 8:46 PM Marc Millas wrote: > Hi, > > postgres 12, postgis

impact join syntax ?? and gist index ??

2023-01-07 Thread Marc Millas
st_within(B.y, A.y) group by A.x; same result, but 85 seconds (every thing in shared buffers, again) if I redo asking with explain analyze, buffers, the plan is very different. if I do create a gist index on geometry column of the big table, both syntax takes 21 seconds. I get the feeling I am

Re: Syntax error when combining --set and --command has me stumped

2022-08-02 Thread Ron
On 7/29/22 04:05, Gianni Ceccarelli wrote: If you can use bash, or set up some redirections from whatever you're using to execute ``psql``, you can do:: $ psql somedb --set num=42 <<<'select :num' Timing is on. Expanded display is used automatically. Line style is unicode. Border

Re: Syntax error when combining --set and --command has me stumped

2022-08-02 Thread Gianni Ceccarelli
If you can use bash, or set up some redirections from whatever you're using to execute ``psql``, you can do:: $ psql somedb --set num=42 <<<'select :num' Timing is on. Expanded display is used automatically. Line style is unicode. Border style is 2. ┌──┐ │ ?column? │ ├─

Re: Syntax error when combining --set and --command has me stumped

2022-07-28 Thread Adrian Klaver
help" for help. postgres=# select :num;  ?column? --    42 (1 row) But trying to use a variable (both with and without single quotes) in a --command statement other than "\echo" throws a syntax error at the colon: $ psql12 --set num=42 -ac "select :num;" sel

Re: Syntax error when combining --set and --command has me stumped

2022-07-28 Thread Ron
On 7/28/22 14:47, David G. Johnston wrote: On Thu, Jul 28, 2022 at 12:40 PM Ron wrote: What secret sauce am I missing to get this to work? Given that the documentation says: "command must be either a command string that is completely parsable by the server (i.e., it contains no psql-spe

Re: Syntax error when combining --set and --command has me stumped

2022-07-28 Thread David G. Johnston
On Thu, Jul 28, 2022 at 12:40 PM Ron wrote: > What secret sauce am I missing to get this to work? > Given that the documentation says: "command must be either a command string that is completely parsable by the server (i.e., it contains no psql-specific features), or a single backslash command.

Syntax error when combining --set and --command has me stumped

2022-07-28 Thread Ron
stgres=# select :num;  ?column? --    42 (1 row) But trying to use a variable (both with and without single quotes) in a --command statement other than "\echo" throws a syntax error at the colon: $ psql12 --set num=42 -ac "select :num;" select :num; ERROR

Re: psql syntax for array of strings in a variable?

2021-10-29 Thread Philip Semanchuk
> On Oct 29, 2021, at 2:05 PM, Tom Lane wrote: > > "David G. Johnston" writes: >> On Friday, October 29, 2021, Philip Semanchuk >> wrote: >>> I would appreciate help with the syntax for querying an array of strings >>> declared as

Re: psql syntax for array of strings in a variable?

2021-10-29 Thread Tom Lane
"David G. Johnston" writes: > On Friday, October 29, 2021, Philip Semanchuk > wrote: >> I would appreciate help with the syntax for querying an array of strings >> declared as a psql variable. Here's an example. >> >> \set important_days ARRAY[&

Re: psql syntax for array of strings in a variable?

2021-10-29 Thread Pavel Stehule
Hi pá 29. 10. 2021 v 19:21 odesílatel Philip Semanchuk < phi...@americanefficient.com> napsal: > Hi, > I would appreciate help with the syntax for querying an array of strings > declared as a psql variable. Here's an example. > > \set important_days ARRAY['monday

Re: psql syntax for array of strings in a variable?

2021-10-29 Thread David G. Johnston
On Friday, October 29, 2021, Philip Semanchuk wrote: > Hi, > I would appreciate help with the syntax for querying an array of strings > declared as a psql variable. Here's an example. > > \set important_days ARRAY['monday', 'friday'] Not sure why the si

psql syntax for array of strings in a variable?

2021-10-29 Thread Philip Semanchuk
Hi, I would appreciate help with the syntax for querying an array of strings declared as a psql variable. Here's an example. \set important_days ARRAY['monday', 'friday'] select 1 where 'monday' = ANY(:important_days); ERROR: 42703: column "monday"

inner subprograms ... Was: syntax question

2021-06-03 Thread Bryn Llewellyn
> br...@momjian.us wrote: > > Oh, I thought he wanted to declare a function inside the function that could > be called only by that function, like private functions in Oracle packages > can do. Yes, you can create a function that defines a function that can be > called later. I guess you coul

Re: syntax question

2021-06-03 Thread Marc Millas
no pb: I am french, so quite skilled on that topic :-) there is only 50 bottles of various malt on the presentoir close to my desk so I must stay reasonnable :-) Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Thu, Jun 3, 2021 at 11:17 PM Adrian Klaver wrote: > On 6/3/21 1:01 PM

Re: syntax question

2021-06-03 Thread Adrian Klaver
On 6/3/21 1:01 PM, Marc Millas wrote: thanks Adrian, exactly what I was missing :-) about knowing if I should... We have to create a set of triggers (insert, update, delete) within a huge set of tables. and that list of tables, and structure of them  can be customized, maintained, ... so we we

Re: syntax question

2021-06-03 Thread Guyren Howe
I know it would be non-standard, but I would love to see Postgres support the likes of nested functions. I know that would be non-standard, but Postgres has lots of non-standard features that make it more like a real programming language and considerably more productive. On Jun 3, 2021, 12:34 -

Re: syntax question

2021-06-03 Thread Marc Millas
I take note of this. thanks Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Thu, Jun 3, 2021 at 10:23 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Jun 3, 2021 at 1:02 PM Marc Millas wrote: > >> about knowing if I should... >> We have to create a set of trigg

Re: syntax question

2021-06-03 Thread David G. Johnston
On Thu, Jun 3, 2021 at 1:02 PM Marc Millas wrote: > about knowing if I should... > We have to create a set of triggers (insert, update, delete) within a huge > set of tables. and that list of tables, and structure of them can be > customized, maintained, ... > so we were looking for a standard s

Re: syntax question

2021-06-03 Thread Marc Millas
thanks Adrian, exactly what I was missing :-) about knowing if I should... We have to create a set of triggers (insert, update, delete) within a huge set of tables. and that list of tables, and structure of them can be customized, maintained, ... so we were looking for a standard script to automa

Re: syntax question

2021-06-03 Thread Marc Millas
good reading, thanks Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Thu, Jun 3, 2021 at 9:21 PM Tom Lane wrote: > Adrian Klaver writes: > > On 6/3/21 12:01 PM, Bruce Momjian wrote: > >> On Thu, Jun 3, 2021 at 08:58:03PM +0200, Marc Millas wrote: > >>> within a function, I want

Re: syntax question

2021-06-03 Thread Bruce Momjian
On Thu, Jun 3, 2021 at 03:21:15PM -0400, Tom Lane wrote: > Adrian Klaver writes: > > On 6/3/21 12:01 PM, Bruce Momjian wrote: > >> On Thu, Jun 3, 2021 at 08:58:03PM +0200, Marc Millas wrote: > >>> within a function, I want to create another function. > > >> You can't create functions inside of

Re: syntax question

2021-06-03 Thread Tom Lane
Adrian Klaver writes: > On 6/3/21 12:01 PM, Bruce Momjian wrote: >> On Thu, Jun 3, 2021 at 08:58:03PM +0200, Marc Millas wrote: >>> within a function, I want to create another function. >> You can't create functions inside of functions; same for procedures. > Sure you can: Yeah. The actual p

  1   2   3   >