pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [GENERAL] ' syntax
8+ messages / 6 participants
[nested] [flat]
* Re: [GENERAL] ' syntax
@ 1999-06-01 14:59 John Browning <jb@benoit.poplar.com>
parent: amarof <amarof@marwan.ac.ma>
2 siblings, 0 replies; 8+ messages in thread
From: John Browning @ 1999-06-01 14:59 UTC (permalink / raw)
To: amarof@marwan.ac.ma; +Cc: pgsql-general
> On Sat, 05 Jun 1999 14:49:49 +0000, amarof <amarof@marwan.ac.ma> said:
> hi all
> i want to include this character ' in a string like "mystring's" but i
> don't know the right syntax for it.
> when i want to enter a string in the filter condition like "doctorat
> d'etat" , i get this error parse error near etat.
> thanks
backslash d\'etat
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [GENERAL] ' syntax
@ 1999-06-01 15:05 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: amarof <amarof@marwan.ac.ma>
2 siblings, 0 replies; 8+ messages in thread
From: Herouth Maoz @ 1999-06-01 15:05 UTC (permalink / raw)
To: Brett W. McCoy <bmccoy@lan2wan.com>; amarof <amarof@marwan.ac.ma>; +Cc: pgsql-general
At 21:24 +0300 on 01/06/1999, Brett W. McCoy wrote:
> Precede the character with a backslash:
>
> mystring\'s
> dotorat d\'etat
The standard is doubling the quote:
mystring''s
dorctorat d''etat
Backslashes are specific to PostgreSQL, and I don't recommend them.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [GENERAL] ' syntax
@ 1999-06-01 18:24 Brett W. McCoy <bmccoy@lan2wan.com>
parent: amarof <amarof@marwan.ac.ma>
2 siblings, 0 replies; 8+ messages in thread
From: Brett W. McCoy @ 1999-06-01 18:24 UTC (permalink / raw)
To: amarof <amarof@marwan.ac.ma>; +Cc: pgsql-general
On Sat, 5 Jun 1999, amarof wrote:
> i want to include this character ' in a string like "mystring's" but i
> don't know the right syntax for it.
> when i want to enter a string in the filter condition like "doctorat
> d'etat" , i get this error parse error near etat.
Precede the character with a backslash:
mystring\'s
dotorat d\'etat
Brett W. McCoy
http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
Chemistry is applied theology.
-- Augustus Stanley Owsley III
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [GENERAL] ' syntax
@ 1999-06-01 19:04 Brett W. McCoy <bmccoy@lan2wan.com>
parent: amarof <amarof@marwan.ac.ma>
0 siblings, 0 replies; 8+ messages in thread
From: Brett W. McCoy @ 1999-06-01 19:04 UTC (permalink / raw)
To: amarof <amarof@marwan.ac.ma>; +Cc: pgsql-general
On Sat, 5 Jun 1999, amarof wrote:
> i got your answers about the syntax, it works with the strings, but when
> etat takes a variable value, it gives a parser error. example : select *
> from table where field like $txt
> the error occurs when txt takes the value (doctortat d'etat).
Is this in Perl or PHP3? You should be doing it like:
"select * from table where field like '$txt';"
It's especially important that your query string be delimited by double
quotes in Perl, or it won't interpolate your variable. If unsure, use
the generic quote facility:
qw(select * from table where field like '$txt';)
where the parentheses are functioning as quote characters.
Brett W. McCoy
http://www.lan2wan.com/~bmccoy
-----------------------------------------------------------------------
It's not enough to be Hungarian; you must have talent too.
-- Alexander Korda
^ permalink raw reply [nested|flat] 8+ messages in thread
* ' syntax
@ 1999-06-05 14:49 amarof <amarof@marwan.ac.ma>
0 siblings, 3 replies; 8+ messages in thread
From: amarof @ 1999-06-05 14:49 UTC (permalink / raw)
To: pgsql-general
hi all
i want to include this character ' in a string like "mystring's" but i
don't know the right syntax for it.
when i want to enter a string in the filter condition like "doctorat
d'etat" , i get this error parse error near etat.
thanks
^ permalink raw reply [nested|flat] 8+ messages in thread
* ' syntax
@ 1999-06-05 15:28 amarof <amarof@marwan.ac.ma>
0 siblings, 1 reply; 8+ messages in thread
From: amarof @ 1999-06-05 15:28 UTC (permalink / raw)
To: pgsql-general
i got your answers about the syntax, it works with the strings, but when
etat takes a variable value, it gives a parser error. example : select *
from table where field like $txt
the error occurs when txt takes the value (doctortat d'etat).
thanks
^ permalink raw reply [nested|flat] 8+ messages in thread
* Syntax
@ 2023-12-07 08:00 arun chirappurath <arunsnmimt@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: arun chirappurath @ 2023-12-07 08:00 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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 at %', CURRENT_TIMESTAMP; end;$$;
Or
Just
Begin;
Update statements
Commit;
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Syntax
@ 2023-12-07 11:14 Ron Johnson <ronljohnsonjr@gmail.com>
parent: arun chirappurath <arunsnmimt@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Ron Johnson @ 2023-12-07 11:14 UTC (permalink / raw)
To: arun chirappurath <arunsnmimt@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Thu, Dec 7, 2023 at 3:01 AM arun chirappurath <arunsnmimt@gmail.com>
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 = row_count; raise info 'selected: % rows', d;
> RAISE INFO 'Script finished at %', CURRENT_TIMESTAMP; end;$$;
>
> Or
>
> Just
>
> Begin;
>
> Update statements
>
> Commit;
>
One shows when the statement started, and when *you think* it ended, while
the other doesn't.
https://www.postgresql.org/docs/15/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
"Since these functions return the start time of the current transaction,
their values do not change during the transaction."
What you really want is clock_timestamp().
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2023-12-07 11:14 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-05 14:49 ' syntax amarof <amarof@marwan.ac.ma>
1999-06-01 14:59 ` John Browning <jb@benoit.poplar.com>
1999-06-01 15:05 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-06-01 18:24 ` Brett W. McCoy <bmccoy@lan2wan.com>
1999-06-05 15:28 ' syntax amarof <amarof@marwan.ac.ma>
1999-06-01 19:04 ` Brett W. McCoy <bmccoy@lan2wan.com>
2023-12-07 08:00 Syntax arun chirappurath <arunsnmimt@gmail.com>
2023-12-07 11:14 ` Re: Syntax Ron Johnson <ronljohnsonjr@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox