Bug 976266

Summary: schema.sql prevents user creation via sql script
Product: [Fedora] Fedora Reporter: Salim Badakhchani <sal>
Component: kojiAssignee: Dennis Gilmore <dennis>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 18CC: dennis, mikeb, mikem, nobody
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-20 16:00:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Working schema.sql file none

Description Salim Badakhchani 2013-06-20 08:58:16 UTC
Created attachment 763329 [details]
Working schema.sql file

Description of problem:  

Strange issue arises with the schema.sql that is shipped with this release.  I used a simple script to create koji users during the installation process which is now broken.  When I diff the working file with the broken file only the order of some sql statements are different but its enough to break the creation of users.  

The diffs:

[root@localhost kojak]# diff schema.sql /usr/share/doc/koji-1.8.0/docs/schema.sql 
736a737,744
> -- tracks the contents of an image
> CREATE TABLE image_listing (
> 	image_id INTEGER NOT NULL REFERENCES image_archives(archive_id),
> 	rpm_id INTEGER NOT NULL REFERENCES rpminfo(id),
> 	UNIQUE (image_id, rpm_id)
> ) WITHOUT OIDS;
> CREATE INDEX image_listing_rpms on image_listing(rpm_id);
> 
748,755d755
< 
< -- tracks the contents of an image
< CREATE TABLE image_listing (
< 	image_id INTEGER NOT NULL REFERENCES image_archives(archive_id),
< 	rpm_id INTEGER NOT NULL REFERENCES rpminfo(id),
< 	UNIQUE (image_id, rpm_id)
< ) WITHOUT OIDS;
< CREATE INDEX image_listing_rpms on image_listing(rpm_id);


The script I use to create the users...

insert into users (name, status, usertype) values ('koji', 0, 0);
insert into user_perms (user_id, perm_id, creator_id) values (1, 1, 1);
insert into users (name, status, usertype) values ('kojiadmin', 0, 0);
insert into user_perms (user_id, perm_id, creator_id) values (2, 1, 1);
\q


Version-Release number of selected component (if applicable):
koji-1.8.0-1.fc18.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create the database and apply schema.sql
2. Attempt to create the users
3.

Actual results:
ROLLBACK
+ su -l koji -c 'psql koji koji < /tmp/users.sql'
ERROR:  relation "users" does not exist
LINE 1: insert into users (name, status, usertype) values ('koji', 0...
                    ^
ERROR:  relation "user_perms" does not exist
LINE 1: insert into user_perms (user_id, perm_id, creator_id) values...
                    ^
ERROR:  relation "users" does not exist
LINE 1: insert into users (name, status, usertype) values ('kojiadmi...
                    ^
ERROR:  relation "user_perms" does not exist
LINE 1: insert into user_perms (user_id, perm_id, creator_id) values...
                    ^
+ systemctl restart postgresql.service


Expected results:

+ su -l koji -c 'psql koji koji < /tmp/users.sql'
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1

Additional info:

Comment 1 Salim Badakhchani 2013-06-20 09:44:53 UTC
I just diffed my working copy with the latest version of the one in https://git.fedorahosted.org/cgit/koji/ and they are identical.  I guess these files have not been pushed out yet as part of the packages made available for general download?

Comment 2 Mike Bonnet 2013-06-20 16:00:04 UTC
Yes, this has been fixed upstream and will be pushed out with the next release.