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

Repo migration fails on Postgres #141

Closed
rspeicher opened this issue Apr 29, 2014 · 23 comments
Closed

Repo migration fails on Postgres #141

rspeicher opened this issue Apr 29, 2014 · 23 comments
Assignees
Labels
💊 bug Something isn't working

Comments

@rspeicher
Copy link
Contributor

  • Go: 1.2.1 darwin/amd64
  • Postgres: 9.3.4
  • Gogs: latest HEAD 2401e68

When running Gogs using a Postgres database, I'm unable to migrate a repository from GitHub. I get the following error: An error is occurred : pq: date/time field value out of range: "0000-12-31 20:00:00"

I tried debugging this myself and got as far as the problem being related to xorm, specifically the auto-updating created and/or updated fields, but with my limited Go knowledge, couldn't get much further.

@unknwon
Copy link
Member

unknwon commented Apr 29, 2014

Thanks for your feedback and locating the issue, I'm notifying @lunny here, he's the author of xorm.

@unknwon unknwon added the bug label Apr 29, 2014
@lunny
Copy link
Contributor

lunny commented Apr 30, 2014

@tsigo, Which repository did you import? I have tested for importing https://github.com/go-xorm/xorm.git and https://github.com/gogits/gogs.git via postgres v9.3.2 on Mac OSX 10.9. Both are OK.

@lunny
Copy link
Contributor

lunny commented Apr 30, 2014

My xorm's reversion is HEAD 8a1f48e

@rspeicher
Copy link
Contributor Author

@lunny Same xorm revision as you. It seems to fail with all of the projects I tried in my profile here on GitHub. Also just tried gogits/gogs itself and got the same error.

@rspeicher
Copy link
Contributor Author

Postgres configuration seems ok.

root=# SELECT NOW();
             now
------------------------------
 2014-04-29 22:48:58.53123-04

Added some debug output to xorm/engine.go (find the lines with *********************). This is the entire run for running the migration operation:

https://gist.github.com/tsigo/3aa3e705889c227319ec

First output after the marking is runtime.Caller(0), the second is the value of v in that block, line 1124 in engine.go

You can see the actual problem on line 52 of that gist. For some reason it gets the wrong value and then immediately right after gets the correct one.

@lunny
Copy link
Contributor

lunny commented Apr 30, 2014

I will brew upgrade to use postgres 9.3.4 to test again.

@lunny
Copy link
Contributor

lunny commented Apr 30, 2014

I have upgraded postgres from 9.3.2 to 9.3.4 and create a new database. And I tested import https://github.com/go-xorm/xorm.git via private or mirror. All tests are ok.
Did you have used NeedAuthorization?

@rspeicher
Copy link
Contributor Author

I didn't. They were all public repos so they shouldn't need it, right?

On Tuesday, April 29, 2014, Lunny Xiao notifications@github.com wrote:

I have upgraded postgres from 9.3.2 to 9.3.4 and create a new database.
And I tested import https://github.com/go-xorm/xorm.git via private or
mirror. All tests are ok.
Did you have used NeedAuthorization?


Reply to this email directly or view it on GitHubhttps://github.com//issues/141#issuecomment-41756778
.

@clee
Copy link
Contributor

clee commented Apr 30, 2014

Using postgresql on Fedora 20 here and importing public repos works great for me with the latest master.

@unknwon
Copy link
Member

unknwon commented May 1, 2014

Any progress on this issue?

@rspeicher
Copy link
Contributor Author

No change. If no one else can duplicate it I guess you can close this.

On Thursday, May 1, 2014, 无闻 notifications@github.com wrote:

Any progress on this issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/141#issuecomment-41903593
.

@unknwon
Copy link
Member

unknwon commented May 1, 2014

I've tested on my Mac and I reproduced this issue. @lunny (clone https://github.com/gpmgo/gopm.git) exactly the same system and version, is it the issue only happens on Mac?

@unknwon
Copy link
Member

unknwon commented May 2, 2014

@tsigo good news, try go get -u github.com/go-xorm/xorm and recompile gogs, my problem has been solved.

@rspeicher
Copy link
Contributor Author

@unknwon @lunny All fixed! Thank you both.

@lunny
Copy link
Contributor

lunny commented May 2, 2014

@tsigo You are welcome!

@bit4bit
Copy link

bit4bit commented Jun 18, 2014

hi,

the same problem,
only when create a issue or milestone,

An error is occurred : pq: date/time field value out of range: "0000-12-31 20:00:00"

gogs version: Application Version: 0.4.3.0610 Alpha

i try:

nothing work.

i try:

  • gogs v0.4.2 and v0.4.0

nothing work.

thanks, great project!! :)

@unknwon
Copy link
Member

unknwon commented Jun 18, 2014

@bit4bit Thanks for your feedback, @lunny will get in touch with you.

@lunny
Copy link
Contributor

lunny commented Jun 18, 2014

OK. @bit4bit, I will test this.

@chumpalump
Copy link

Same problem with 0.4.2.0605 Alpha and psql (9.3.5)

An error is occurred : pq: date/time field value out of range: "0000-12-31 19:00:00"

@unknwon
Copy link
Member

unknwon commented Sep 2, 2014

@lunny

@chumpalump
Copy link

I'm getting this on issue creation. Let me know if I should file a new bug.

[martini] Started POST /dhjr/gtest/issues/new
2014/09/01 22:09:52 [repo.go:24] [T] []
2014/09/01 22:09:52 [repo.go:236] [D] displayBare: false; IsBare: false
2014/09/01 22:09:52 [context.go:124] [E] issue.CreateIssue(NewIssue): pq: date/time field value out of range: "0000-12-31 19:00:00"
[martini] Completed 500 Internal Server Error in 14.538355ms

@unknwon
Copy link
Member

unknwon commented Sep 2, 2014

@chumpalump does go get -u github.com/go-xorm/xorm solve your problem?

@chumpalump
Copy link

Updated xorm and gogs, and now I get a 200. So, xorm problem is solved. Oddly, the submission results in json being returned, not html.

{
  "data": "/dhjr/gtest2/issues/1",
  "ok": true,
  "status": 200
}

For reference:

2014/09/01 22:27:11 [T] Custom path: /home/dhjr/lib/gocode/src/github.com/gogits/gogs/custom
2014/09/01 22:27:11 [T] Log path: /home/dhjr/lib/gocode/src/github.com/gogits/gogs/log
2014/09/01 22:27:11 [I] Gogs: Go Git Service 0.4.9.0831 Beta
2014/09/01 22:27:11 [I] Log Mode: Console(Trace)
2014/09/01 22:27:11 [I] Cache Service Enabled
2014/09/01 22:27:11 [I] Session Service Enabled
2014/09/01 22:27:11 [I] Run Mode: Development
2014/09/01 22:27:11 [I] Listen: http://0.0.0.0:3000

...

[Macaron] Started POST /dhjr/gtest2/issues/new for 127.0.0.1:51414
2014/09/01 22:30:37 [T] 2 Issue created: 1
[Macaron] Completed /dhjr/gtest2/issues/new 200 OK in 45.327968ms

lunny added a commit that referenced this issue Sep 2, 2014
strk added a commit to strk/gogs that referenced this issue Nov 11, 2016
From code.gitea.io/go-sdk/gitea
  To code.gitea.io/sdk/gitea
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💊 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants