mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Doc: use uppercase keywords in SQLs
Use uppercase SQL keywords consistently throughout the documentation to ease reading. Also add whitespace in a couple of places where it improves readability. Author: Erik Wienhold <ewie@ewie.name> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/82eb512b-8ed2-46be-b311-54ffd26978c4%40ewie.name
This commit is contained in:
@@ -1065,7 +1065,7 @@ $$ LANGUAGE plpython3u;
|
||||
<programlisting>
|
||||
CREATE FUNCTION count_odd_iterator() RETURNS integer AS $$
|
||||
odd = 0
|
||||
for row in plpy.cursor("select num from largetable"):
|
||||
for row in plpy.cursor("SELECT num FROM largetable"):
|
||||
if row['num'] % 2:
|
||||
odd += 1
|
||||
return odd
|
||||
@@ -1073,7 +1073,7 @@ $$ LANGUAGE plpython3u;
|
||||
|
||||
CREATE FUNCTION count_odd_fetch(batch_size integer) RETURNS integer AS $$
|
||||
odd = 0
|
||||
cursor = plpy.cursor("select num from largetable")
|
||||
cursor = plpy.cursor("SELECT num FROM largetable")
|
||||
while True:
|
||||
rows = cursor.fetch(batch_size)
|
||||
if not rows:
|
||||
@@ -1086,7 +1086,7 @@ $$ LANGUAGE plpython3u;
|
||||
|
||||
CREATE FUNCTION count_odd_prepared() RETURNS integer AS $$
|
||||
odd = 0
|
||||
plan = plpy.prepare("select num from largetable where num % $1 <> 0", ["integer"])
|
||||
plan = plpy.prepare("SELECT num FROM largetable WHERE num % $1 <> 0", ["integer"])
|
||||
rows = list(plpy.cursor(plan, [2])) # or: = list(plan.cursor([2]))
|
||||
|
||||
return len(rows)
|
||||
|
||||
Reference in New Issue
Block a user