Here is another idea for a contribution - refactoring.

Currently there are a lot of procedures in PostgreSQL code that
definitely don't fit on one screen (i.e. ~50 lines). Also many files are
larger than say 1000 lines of code. For instance, psql_completion
procedure is more than 2000 lines long! I think patches that would make
such code easier to read would have a good chance to be accepted.

In case you are interested I wrote a script that scans PostgreSQL code
and then prints procedures names and corresponding number of lines of
code (see attachment).

Best regards,
Aleksander Alekseev
#!/usr/bin/env python3

import sys
import os
import re

def process_file(fname):
	nlines = 0
	procname = ""
	with open(fname) as f:
		for line in f:
			nlines += 1
			if"^{", line):
				nlines = 0
			elif"^}", line) and procname and (nlines > 0):
				print("{:08d}:{}".format(nlines-1, procname))
				procname = ""
				m ="^(\\w+)\\s*\\(", line)
				if m:
					procname =

def recursive_search(path):
	for file in os.listdir(path):
		if (file == ".") or (file == ".."):

		full_name = os.path.join(path, file)
		if not os.path.islink(full_name):
			if os.path.isdir(full_name):

			if"\\.c$", file):

if len(sys.argv) < 2:
	print("Usage " + sys.argv[0] + " <path>")

start_path = sys.argv[1]
Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to