Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 May 2008 at 00:47 UTC
Updated:
11 Jun 2010 at 15:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dries commentedI assume the changes to bootstrap.inc are "optional"? ;-)
Could you add a one-line code comment?
CHECK($name >= 0)is new to me.Comment #2
bjaspan commentedThe change to bootstrap is an accident. :-)
Comment #3
damien tournoud commentedSome discussion about this already occurred some years ago, in #60871.
Comment #4
bjaspan commented@#3: Thanks for the pointer, I did not know about that issue.
New patch attached. Turns out D6 pgsql driver also does not support unsigned floats; also fixed.
Comment #5
dries commentedI've committed this patch to CVS HEAD. Would be better if it came with tests.
Comment #6
bjaspan commentedOkay, I'll mark it CNW pending tests.
Comment #7
bjaspan commentedTests for signed/unsigned int, float, and numeric columns for HEAD. Remember to 'cvs add' this new file.
Comment #8
damien tournoud commentedOn 7.x, this patch causes a lot of exceptions during testing:
I'm not sure if this is a simpletest / SchemaAPI bug or a bug with that patch.
Comment #9
bjaspan commentedIt is not this patch that causes those exceptions; every test on pgsql throws those exceptions with or without this patch.
See http://drupal.org/node/257009 which fixes simpletest for pgsql.
Comment #10
elyobo commentedCan I ask how this is coming along? I just ran into the same problem installing the development version of Ubercart with D6.4. The fix looks trivial, is there some holdup?
Comment #11
linuxpoet commentedI am having problems determining what the actual problem here is. The errors listed on the page are obvious, it can't create the type because the type already exists. What is the actual problem?
Comment #12
Anonymous (not verified) commentedIf this works for 6.x, I'd ask that it be implemented, and that development to fix the issues in 7.x be continued separately.
A lot of people are using 6.x now, and this is bug prohibits some of us from using certain modules (for example, the Amazon module).
Comment #13
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #14
damien tournoud commentedWere duplicates:
#334791: PostgreSQL not handling unsigned properly
#334794: PostgreSQL not handling unsigned properly
#334598: PostgreSQL not handling unsigned properly
Comment #15
linuxpoet commentedI repeat the assertion tha this is a no-op problem. The errors that people mentioned are because the types already existed and it looks as if it has been solved in other tickets. I am going to close this ticket. Please re-open with an actual problem if there is one :)
Comment #16
linuxpoet commentedComment #17
stormsweeper commentedIn D7, DBTNG apparently fixes this by adding in CHECK constraints instead of the D5/D6 solution of creating domains.
D5/D6 uses domains for the int types, but this won't work for numeric, since the precision and scale parameters need to be defined when the domain is created. I'd support back-porting the D7 solution as with schema api there isn't really any worry of breaking extant modules. The serial type is already handled this way.
The patch attached just changes the PGSQL driver function that generates the SQL for field definitions. It could be extended to take out the domain creation in system_install, although you would not want to drop the domains.
Comment #18
stormsweeper commentedThe latest offender here is the Twitter module, which just changed it's primary key to numeric from int. On Postgres, this severely borks your table on update.
Also, please use this patch. I accidentally did not revert some other edits I was working on.
Comment #19
stormsweeper commentedBetter yet, use this one. I had to move the unsigned bit after the length/precision bit. Going to file a new issue for D7, since the same error exists there.
Comment #20
stormsweeper commentedMight help if I included the patch.
Comment #21
stormsweeper commentedD7 patch here: #522786: Postgres numeric check needs to happen after precision check in schema generation
Comment #22
darren ohUnsigned types are added to PostgreSQL during installation. The problem is that some are missing. Thanks to ccurvey for pointing this out in issue 359764.
Comment #23
shunting commentedAs a PG lurker, let me thank you all for doing this. It's been a constant source of frustration (and a source of secret shame to me when I hack install files and the odd function or two)...
Comment #24
stormsweeper commentedDarren, you can't specify precision, length, or scale for domains after they are created, ie,
Will barf.
Comment #25
darren ohThanks.
Comment #26
stormsweeper commentedNow we're back to this issue's original post - the unsigned numeric type (specified in schema api) can't be created.
Also, I still think domains are an anti-pattern we don't need to use, and in fact are not used in D7. I presume the argument for them in D4 and D5 was to offer types that made it easier for people to just copy over mySql schema definitions, rather than using the CHECK clause in the column definition directly. I think we should just check for the unsigned flag on the appropriate types and add the CHECK clause rather than adding a bunch of domains and special casing things.
Comment #27
stormsweeper commentedAs a side point, the use of a CHECK clause is likely pointless since the unsigned types seem to be used in Drupal for the expanded range of values, which you don't get with Postgres and a CHECK clause. You could bump unsigned int to bigint, but that would leave you without any recourse for bigints except to then switch to a numeric column. Messy.
Comment #28
darren ohThe patch in #20 works.
Comment #29
gábor hojtsy#522786: Postgres numeric check needs to happen after precision check in schema generation is the very same patch as #20 is here (but with added tests), so marking postponed on that one getting into Drupal 7. I'm not supposed to commit changes before they land in D7, unless they do not apply to D7. As soon as that one is committed, please reopen this.
Comment #30
webchickThe other patch has been committed. Moving back to RTBC.
Comment #31
webchickWell... hold that thought. :P The 7.x patch caused test failures, so I had to roll it back. Hopefully will be a quick fix.
Comment #32
tr commentedMoving back to RTBC again since webchick re-committed the 7.x patch (http://drupal.org/node/522786#comment-2573732) and #522786: Postgres numeric check needs to happen after precision check in schema generation is now marked as "fixed".
Comment #33
andypostwhat status of this issue?
Comment #34
Anonymous (not verified) commented#522786: Postgres numeric check needs to happen after precision check in schema generation is committed - can we get this one committed too?
Comment #35
esteewhy commentedpgsql-numeric-unsigned.patch queued for re-testing.
Comment #36
gábor hojtsyCommitted, thank you.