Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.pg C error. This should never happen. #21288

Open
KrasNIX opened this issue Apr 15, 2024 · 0 comments
Open

db.pg C error. This should never happen. #21288

KrasNIX opened this issue Apr 15, 2024 · 0 comments

Comments

@KrasNIX
Copy link

KrasNIX commented Apr 15, 2024

V doctor:

V full version: V 0.4.5 6a3d8d2.c4c6b9f
OS: linux, Debian GNU/Linux 12 (bookworm)
Processor: 20 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz

getwd: /NVME/work/cb/v/1c-ib-get-size
vexe: /opt/v/v
vexe mtime: 2024-04-08 12:08:26

vroot: OK, value: /opt/v
VMODULES: OK, value: /root/.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.39.2
Git vroot status: Error: fatal: не найден git репозиторий (или один из родительских каталогов): .git
.git/config present: false

CC version: cc (Debian 12.2.0-14) 12.2.0
thirdparty/tcc: N/A

What did you do?
v -g -o vdbg cmd/v && vdbg src/main.v

module main

import os
//import strconv
import db.pg

const pg_host = os.getenv_opt('PGHOST') or { 'localhost' }
const pg_user = os.getenv_opt('PGUSER') or { 'postgres' }
const pg_pass = os.getenv_opt('PGPASS') or { 'xxx' }
const pg_db = os.getenv_opt('PGDATABASE') or { 'postgres' }

fn main() {
	println('Подключение к PostgreSQL ' + pg_host)
	db := pg.connect(pg.Config{
		host: pg_host
		user: pg_user
		password: pg_pass
		dbname: pg_db
	}) or {
		println('Не удалось подключиться')
		println(err)
		return
	}
	databases := db.exec('select t1.datname AS db_name, pg_database_size(t1.datname) as db_size from pg_database t1 order by db_name desc;') or { println(err); exit(1) }

	for i in databases
	{
		if name := i.vals[0]
		{
			println(name)
		}
		else
		{
			println('err')
		}



	}
}

What did you expect to see?

C error. This should never happen.

What did you see instead?

==================
/tmp/v_0/main.01HVGMR0HP1WAV3D35BKJPXFHJ.tmp.c:24311: error: '_t4' undeclared
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant