Code Monkey home page Code Monkey logo

pq.go's Introduction

pq.go's People

Contributors

bmizerany avatar federomero avatar kr avatar mikelikespie avatar samuel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pq.go's Issues

Not seeing error

When I am getting primary key collisions not using Exec, it is returning Nil as an error. Sorry if I'm missing something

Error on query that includes custom types

I use custom types in postgres. In this example I use a json typed column named data.
when I run

    rows, err := db.Query("SELECT id,data  from relationship limit 1")
    if err != nil {
        log.Print(err)
    }

I get

2012/02/02 12:28:24 Code: (42703) - File: (.\src\backend\parser\parse_expr.c) - Message: (column "data" does not exist) - Line: (760) - Position: (19) - Severity: (ERROR) - Routine: (transformColumnRef)

even

    rows, err := db.Query("SELECT id,data::varchar  from relationship limit 1")
    if err != nil {
        log.Print(err)
    }

yields the same error

I am really excited about this project.
I just need a little help on where to start to fix this error.
I am unfamiliar with the postgres wire protocol but if you point me to a reference i can figure it out.

Driver panics on exec statement

Using Go1 Rc2 and a version of the driver from the over branch that I just cloned today trying to do an insert statement via the sql.Exec function causes the driver to panic. The stacktrace from Go is as follows:

panic: todo

goroutine 3 [running]:
github.com/bmizerany/pq.(*stmt).Exec()
    /home/vendion/gocode/src/github.com/bmizerany/pq/conn.go:356 +0x4c
database/sql.(*DB).exec(0xf84006a880, 0x6719dc, 0xf800000046, 0xf840069600, 0x300000003, ...)
    /usr/local/go/src/pkg/database/sql/sql.go:363 +0x381
database/sql.(*DB).Exec(0xf84006a880, 0x6719dc, 0x65736e6900000046, 0x7f50842fcc70, 0x300000003, ...)
    /usr/local/go/src/pkg/database/sql/sql.go:332 +0xd5
main.getReading()
    /home/vendion/Projects/cerberus/client.go:45 +0x3b7
main.runclient()
    /home/vendion/Projects/cerberus/client.go:29 +0x145
created by main.main
    /home/vendion/Projects/cerberus/cerberus.go:61 +0x54c

goroutine 1 [chan receive]:
main.main()
    /home/vendion/Projects/cerberus/cerberus.go:67 +0x61c

goroutine 2 [syscall]:
created by runtime.main
    /tmp/bindist343577657/go/src/pkg/runtime/proc.c:221

goroutine 4 [syscall]:
syscall.Syscall6()
    /tmp/bindist343577657/go/src/pkg/syscall/asm_linux_amd64.s:40 +0x5
syscall.EpollWait(0xf800000007, 0xf84008b170, 0xa0000000a, 0xffffffff, 0xc, ...)
    /usr/local/go/src/pkg/syscall/zerrors_linux_amd64.go:1781 +0xa1
net.(*pollster).WaitFD(0xf84008b160, 0xf84006a940, 0x0, 0x0, 0x0, ...)
    /usr/local/go/src/pkg/net/fd_linux.go:146 +0x110
net.(*pollServer).Run(0xf84006a940, 0x0)
    /usr/local/go/src/pkg/net/fd.go:236 +0xe4
created by net.newPollServer
    /usr/local/go/src/pkg/net/newpollserver.go:35 +0x382

As the error is a "todo" I can't tell exactly what is wrong but the line of code that caused this is:

rows, err := db.Exec("insert into request (id, command, serialnumber) values ($1, $2, $3)", v.Id, v.Command, v.Serial)

At this point err comes back not nil

sql: unknown driver "postgres" (forgotten import?)

With using the version of the pq.go driver from the "over" branch I can get the package to build and install, but when I import the driver and try to connect the connection fails with this error:

panic: sql: unknown driver "postgres" (forgotten import?)

the way that I am importing it is as follows:

import (
    "fmt"
    "os"
    "database/sql"
    _ "github.com/bmizerany/pg.go"
)

My connect statement is this line:

db, err := sql.Open("postgres", "dbname=pgtest user=pguser password=password port=5432")

My version of Go is:

go version weekly.2012-03-04 +5c664f190e4e

Am I doing something wrong or is this an issue with the driver?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.