Create index is not working for me in v13.5

Joshua Fletcher (5/29/14 12:20AM)
TerrysLee (5/29/14 8:46AM)
Joshua Fletcher (5/29/14 7:11PM)
Timothy Penner (5/29/14 7:49PM)
Arnaud de Montard (5/30/14 12:34AM)


Joshua Fletcher (5/29/14 12:20 AM)

Index creation will fail if the field contains duplicate values. ?Also
note: PK creation will fail if the field contains NULL values.

What happens if you create an index using the structure editor, or via
4D commands, on the same field?

You've got "_t" on $tableName_t but what about $index_Name or
$fieldname? If those are typos then you have empty variables most
likely.

-Josh

--
Josh Fletcher
Technical Account Manager
4D, Inc

color><param>00000,0000,DDEE/param>
/color>

-----Original Message-----
color><param>00000,0000,DDEE/param>FFrom: 4d_tech-bounces@...
[mailto:4d_tech-bounces@...
On Behalf Of TerrysLee
Sent: Wednesday, May 28, 2014 2:14 PM

I get this error when I run this code

$index_Name:="ForPK"

?// CREATE THE INDEX
$sql_t:=""
$sql_t:=$sql_t+"CREATE INDEX "+$index_Name
$sql_t:=$sql_t+" " ?// Need a space
$sql_t:=$sql_t+"ON "+$tableName_t+" ("+$fieldName+")"

?//e.g. ?=A0?$sql_t:="CREATE INDEX SQL_UID_Stamp ON $tableName_t
($fieldName)"

Begin SQL
?=A0?=A0?=A0?EXECUTE IMMEDIATE :$sql_t;
End SQL

<http://4d.1045681.n5.nabble.com/file/n5730733/CreateIndexerror.jpg>
/color>

TerrysLee (5/29/14 8:46 AM)

My $sql_t variable contains "CREATE INDEX ForPK ON
_Dictionary_Field__Choices
(SQL_UID_Stamp)"

the error says the column is already indexed but is is not indexed.

I found the problem; ?In SQL every index no matter which table has to
be
unique. That was causing the problem. I tried to name the index the
same in
two different tables.

That is why I got the error "this column is already indexed" I think
the
error should be "This index name is already been used".

Thanks for the help at least it help me figure this out.

--
View this message in context:

http://4d.1045681.n5.nabble.com/Create-index-is-not-working-for-me-in-v13-
5-tp5730733p5730750.html
Sent from the 4D Tech mailing list archive at Nabble.com.

Joshua Fletcher (5/29/14 7:11 PM)

color><param>00000,0000,DDEE/param>
/color>

-----Original Message-----
color><param>00000,0000,DDEE/param>II think the
error should be "This index name is already been used".
/color>
Agreed, you should report that as a bug.

Kind regards,

Josh

--
Josh Fletcher
Technical Account Manager
4D, Inc

Timothy Penner (5/29/14 7:49 PM)

Hi Terry,

I did a quick test and I see this is true going back to v11. The index
name must be unique when using SQL to create the index. However I
didn&iacute;t see the error you quoted ?"this column is already indexed" I
only saw the errors listed in the screenshot you posted:
<http://4d.1045681.n5.nabble.com/file/n5730733/CreateIndexerror.jpg>

What did you do to see "this column is already indexed" ?

-Tim

-----Original Message-----
That is why I got the error "this column is already indexed" I think
the error should be "This index name is already been used".

Arnaud de Montard (5/30/14 12:34 AM)

Le 29 mai 2014 ?=A0 22:27, TerrysLee a ?=A9crit :

color><param>00000,0000,DDEE/param>II did not see "this column is
already indexed" I miss quoted myself. In the
error list at the end of the manual I found 1155 = INDEX ALREADY
EXISTS.

Sorry for the mis-information.
/color>
anyway, thanks for your feedback, good to know.

?=80 in 4D SQL Reference doc

<<http://doc.4d.com/4D-SQL-Reference-13.4/SQL-Commands/CREATE-INDEX.300-12
25628.en.html>
I added a user comment (BTW it's a pity that users comments are so
poorly used)
?=80 in 4D language doc

<<http://doc.4d.com/4D-Language-Reference-13.5/Structure-Access/CREATE-IND
EX.301-1457655.en.html>
"If the indexNameindex already exists, the command does nothing."

It doesn't seem consistent that sql throws an error while language
does nothing.

--
Arnaud de Montard

Reply to this message

Summary created 5/30/14 at 9:17AM by Intellex Corporation

Comments welcome at: feedback@intellexcorp.com